Q:

Is it possible for me to set a collection of pixels to a (R,G,B) value in OpenCV?

I have been trying to set a collection of pixels to red by doing this:
for(j=0;j<180;j++){
  for(i=0;i<180;i++){
    cv::Vec3b color =frame.at<cv::Vec3b>(j,i);
    color[0]=0;
    color[1]=0;
    color[2]=255;
    frame.at<cv::Vec3b>(j,i) = color;
  }
}

Instead it results in this
I get rgb style layers like what you would see if you looked at a CRT tv really close. How should I be doing it if I would like to set specific pixels to an RGB value? I'm probably doing something really stupid :( If you think I can provide any more information to help please let me know. I'm very new to this :)

A:

The input(frame in your case) is not of CV_8UC3type.It must be of CV_8UC4 that is why the pattern of RGB repeats in results image because of non referenced fourth channel which causes one byte shifting for each pixel. You must use Vec4b instead of Vec3b to get correct result.

