Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

change pixel value return false!

i have a program that check values of pixels to be in range

but the result surprize me!

only just part of image affected and smoky area arnt in range!

please help me

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/video/video.hpp>

using namespace std;
using namespace cv;

void colorDetect(Mat mFrame,int redThreshold, double saturationThreshold)
    Mat temp;
    GaussianBlur(mFrame, temp, Size(3, 3), 0);
    Mat img;

    for (int i = 0; i < temp.rows; i++) {
        for (int j = 0; j < temp.cols; j++) {

            Vec3b& hsv =<Vec3b>(i, j);

            Vec3b& v =<Vec3b>(i, j);

                    if((abs(v[2]-v[1])<=20 && abs(v[0]-v[1])<=20 && abs(v[2]-v[0])<=20 && hsv[1]<=0.4)  ){
              <uchar>(i, j) = 255;


              <uchar>(i, j) = 0;



int main(){

    Mat frame=imread("D:/121.jpg",1);

    return 1;