How to calculate disparity, using imgL and imgR in the CMYK system?

iuri
Mon, 27 Mar 2023 22:44:58 +0000
Python

Reading image as RGB and converting them to CMYK resulted in a better color definition to identify markers attached to an actuator. As you can see them in magenta, in the CMYK image attached.

Now, they must be sterilized to calculate disparity, as in:

stereo = cv.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(CMYK_L, CMYK_R)

However, the following error occurs:

error: OpenCV(4.7.0) /io/opencv/modules/calib3d/src/stereobm.cpp:1173: error: (-210:Unsupported format or combination of formats) Both input images must have CV_8UC1 in function ‘compute’

I assumed the error’s because CMYK has a fourth dimension (i.e. K), causing calculations to break.

How can images be converted from CMYK to grayscale directly? (so that I could reuse stereo.compute()

Should I use another color system? or even better, does stereo.compute() support CMYK system?

Converting them back to RGB is not am option/solution. Because markers get lost when the image is converted from RGB to grayscale.

Markers get similar gray as the scenario, making it hard, to any openCV lib or segmentation algorithm such as Cany, to track marker’s coordinates (x,y) accurately.

Do I need to convert them to another system? which one?

error: OpenCV(4.7.0) /io/opencv/modules/calib3d/src/stereobm.cpp:1173: error: (-210:Unsupported format or combination of formats) Both input images must have CV_8UC1 in function ‘compute’

2 posts - 2 participants