How can I use CvCamera with cvtColor
Hi, I need little help, because I can't figure out how to run solution from python in your library. Assuming that I'm capturing video in my python script, I just do simple color transformation:
video_hsv = cv2.cvtColor(video_frame, cv2.COLOR_RGB2HSV_FULL)
cv2.imshow('HSV Color Space', video_hsv)
I would like to do the same in react-native, but I can't figure out how to do it. Currently, I have this code:
const cvtColorParams = { p1: 'rgba', p2: 'rgba', p3: ColorConv.COLOR_RGB2HSV_FULL };
return (
<CvInvoke func="cvtColor" params={cvtColorParams}>
<CvCamera
style={styles.camera}
facing={cameraType}
ref={cameraRef}
overlayInterval={100}
onFrameSize={handleFrameSize}
>
{children}
</CvCamera>
</CvInvoke>
);
Also when i change cvtColor params to:
{ p1: 'srcMat', p2: 'dstMat', p3: ColorConv.COLOR_RGB2HSV_FULL }
The app is crashing instantly.
I am guessing that there is problem with "p1" and "p2" because everytime no filters are applied or app crashes. But I would like to ask, what should be in "p1" and "p2" to make this work?
Best, Piotr
Hi Piotr, That looks correct. There could be a bug. I thought I fixed that issue with the 1.0.8 release. Are you using the 1.0.8 release? I added you as a contributor so if there is a bug and you would like to fix it.
I will take a look at it when I have a little more time. I think there may be a workaround but I do not remember offhand what it was. One thing you can do is write to an interMat with the same size and dimensions as the source Mat and then write that back out to 'rgba.' I know that is a hack but I will look into this further in a couple of days I am super busy right now. Best regards, Adam
I did not mean dimension I meant colorspace.
Yup, I am using 1.0.8 release. The problem only affects the camera, with images everything works fine. I see some errors in xCode, so thanks for invitation and I'll try to fix this.
Thanks @piotrrussw! I will try to look at that today too.
I tried to fix this, but with no luck :( Thanks for help!