ANDROID - color detection using openCV - how to?

前端 未结 4 1290
谎友^
谎友^ 2021-01-31 12:56

my goal is to display a threshed image using the HSV color space in a way that only yellow objects will be shown. i use this code (based on a code given by the openCV 2.3.1 andr

4条回答
  •  无人及你
    2021-01-31 13:22

    Well as far as I see it you fetch the image frame in RGBA and save it under the name "mHSV"

    capture.retrieve(mHSV, Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);

    so you should there store it as mRgba

    in the cvtColor you need to transform it to HSV via COLOR_RGBA2HSV. Assuming you have changed the names this would be:

    Imgproc.cvtColor(mRgba, mRSV, Imgproc.COLOR_RGB2HSV, 0);
    

    And I assume this repetition of the images comes from the "4" in you cvtColor function since your HSV picture will only have 3 channels. Put in a 0 there and it should be detected automatically...

    I hope it helps...

提交回复
热议问题