Chromakey-like video cropping without actual green screen. Resulted PNG files will contain alpha channel for transparency.
Since there are a lot of different images types that need to be cropped, it would be your job to choose which options give better results. To do so:
- Run
find_best(), setpathto your file. It will output 6 pairs of PNG files intofind_bestfolder. - Choose best result (for example
00000_HSV_0.png-- this means that HSV color space should be used (mask_as_hsv = True) and mask channel should be 0 (mask_channel = 0)) - Run
chromakey_video2png()with options from step 2. Preferably setframes_max = 10to proceed only first 10 frames. - Modify
marginoption in range from 10 to 90 to get best results. - Modify
kernel_ones,dilateandbluroptions in range from 0 to 5 to get best results. - Finally run
chromakey_video2png()withframes_max = -1to process all frames.
Utilises OpenCV and multithreading (multiprocessing) for
maximum speed.
Based on https://stackoverflow.com/a/66355953
