How to do image process on a file with 100 image

asked 2018-01-23 01:41:34 -0500

NirvanaDon gravatar image

Hey guys im trying to do image process on a file with 100 images. This is the code i used to do just one of the image.

img = cv2.imread('frame1.jpg')

mimg = cv2.medianBlur(img,15)

gimg = cv2.cvtColor(mimg,cv2.COLOR_RGB2GRAY)

ret,th1 = cv2.threshold(gimg, 160,255,cv2.THRESH_BINARY)

ret,th2 = cv2.threshold(th1, 160,255,cv2.THRESH_BINARY_INV)

cv2.imwrite('threshbinaryinv.jpg', th2)

There are total of 100 of this images in a folder name "data". Each of the image is named as frame1.jpg , frame2.jpg, frame3.jpg..

I'm trying to get a code that process all 100 image and display them out individually after.

edit retag flag offensive close merge delete


sturkmen gravatar imagesturkmen ( 2018-01-23 05:49:19 -0500 )edit

but i'm not using video.. its images from a folder name data. theres like 100 of those images

NirvanaDon gravatar imageNirvanaDon ( 2018-01-25 23:59:33 -0500 )edit

explained in the doc

filename    it can be:
name of video file (eg. video.avi)
or image sequence (eg. img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
or URL of video stream (eg. protocol://host:port/script_name?script_params|auth). Note that each video stream or IP camera feed has its own URL scheme. Please refer to the documentation of source stream to know the right URL.
sturkmen gravatar imagesturkmen ( 2018-01-26 02:03:07 -0500 )edit