i want to remove specific frame from opened video in opencv like this
a=cv2.VideoWriter("output.avi",cv2.VideoWriter_fourcc(*"XVID"),30,(1920,1080))
b=time()
while time()-b<3:
a.write(cv2.cvtColor(array(ImageGrab.grab()),cv2.COLOR_BGR2RGB))
a.release()
for example i need to remove the first or second or nth of it
how can i do that?
Related
This is the code if you would like to just look at it. By the way I am using regular python on trinket.io
link for image, since i cant embed images yet
You have indentation issue for accessing first image go with index 0 and for second image go for index 1 and for third image go with index 3
// for first image
background.bgpic(my_maps[0])
// for second image
background.bgpic(my_maps[1])
// for third image
background.bgpic(my_maps[2])
I am new in Pandas, After I use the for loop, the output is rotating and column is swapping with row's position. How can i still keep the output same as its in file?
for i in range(1,100):
print(df.loc[(i*2)])
I'm trying to add a border to a PDF exported from ArcMap, using arcpy. I've not been able to find the answer to this anywhere, nor does arcpy seem to have any documentation on this.
Oddly enough, the map layout from which I'm exporting already has a black border around it, but when I export to a PDF, there is no border. My code here:
#Export to PDF
currentMXD_Map = (r"myMap.mxd")
mxd_Map = arcpy.mapping.MapDocument(currentMXD_Map)
df_Map = arcpy.mapping.ListDataFrames(mxd_Map,"*")[0]
arcpy.mapping.ExportToPDF(mxd_Map, r"myMap.pdf", df_Map,
df_export_width=3300,
df_export_height=2550)
mxd_Map.save()
I would think arcpy.mapping has a method to add border to a PDF export (or in the map layout). What can I try next?
arcpy is not designed for map or layout authoring. It is designed to manipulate existing layouts or maps. Here's a quote from the documentation
The arcpy.mapping module was designed so that it can be used to modify
existing elements within already existing map documents (.mxd) or
layer files (.lyr). In other words, it helps with the automation of
existing features but it can't be used to author new objects.
The easiest way to "add" a border is to have a border already in your map layout with size set to 0 or positioned off screen and then to use arcpy to make it visible or move it where you want. It seems you already have the border so maybe it's not in the right place or is set to 0 width.
Either way, you can access the border element by giving it a name in arcmap and then accessing with ListLayoutElements.
First fill in the "Element Name" in the elements properties in arcmap. notice how I've set the height and width to 0 so that it won't be visible normally.
Then access the element with ListLayoutElements
#we want the first border element because we are assuming there is only one.
#iterate or change index depending on your scenario
borderElement = arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT", "border_element")[0]
borderElement.elementHeight = y
borderElement.elementWidth = x
The sample data
Hello, I am totally new to python and need help in this particular problem.
My excel sheet contains two column Slides and Slide Number.
I would like to take the first column and find the first two Centre_Target, and see if there is Correction_Image between them, if correction image is there between them then count the occurrences of Image 1 between the Centre_Target and Correction_Image. And continue this count of image 1 in similar pattern till the last Centre_Target.
In the .jpg image, I have attached
Answer: The no. of image 1 count here according to the condition is: 1
I need help in coding this in python
Much Thanks!
I have a PDF I am generating using ReportLab. I am using the standard TableOfContents flowable, but am trying to split it up into two columns, so it will all fit on the first page. the content will only ever be on one level, so I am not worried about odd-looking indentations.
Right now I have the PageTemplate using 2 Frames to create 2 columns on the first page. I get a
LayoutError: Flowable <TableOfContents at 0x.... frame=RightCol>...(200.5 x 720) too large on page 1 in frame 'RightCol'(200.5 x 708.0*)
Any ideas?
Well, color me embarrassed.
For anyone else having this problem, check your DocTemplate for allowSplitting. The default is 1, but I had changed mine to 0 and that was the reason.
*facepalm*