0

I work with OpenCV 2.4.11+Qt and try to make a video and change the intensity of the red/blue or green channel but did not find any functions or settings to do this. Does anyone know how to do this?

Phil
  • 1
  • 2

1 Answers1

1

If you just want to change the R/G/B value of one particular pixel, use something like:

cv::Mat img; // suppose this is one frame of the video, in CV_BGR
...
img.at<cv::Vec3b>(idx_row, idx_col) = cv::Vec3b(new_b, new_g, new_r); // change here

If you want to change all values of given channel efficiently without changing other channels, check out How to set given channel of a cv::Mat to a given value efficiently without changing other channels?

Community
  • 1
  • 1
herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
  • Yeah i want to build a slider for each channel, which will modify the image. But when i set every pixel to a given value, the hole image is e.g. gray or whatever. how can i just modify an image so it becomes more blue or more red. – Phil Sep 30 '15 at 13:41
  • @Phil In this case, you can try to overlay a blue/green/red image on the original image to simulate the effect. – herohuyongtao Sep 30 '15 at 13:46