Getting pixel color

I would like to get the RGB values of a pixel at different x, y coordinates on the screen. How would I go about this in C++?

The end goal is to create my own gaussian blur effect.

This would be in Windows 7.

I currently have this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <windows.h>

using namespace std ;

int main(){

    HDC dc = GetDC(NULL);
    COLORREF color = GetPixel(dc, 0, 0);
    ReleaseDC(NULL, dc);

    cout << color; 

}



However when I try to compile it in Bloodshed Dev-C++, I get this:
[Linker error] undefined reference to `GetPixel@12'

Last edited on
How about openCV2.2?
http://opencv.willowgarage.com/wiki/
 
Mat_<cv::Vec3b> A = cv::imread("XXX.bmp"); //A have all of the pixels of XXX.bmp 

if you want to do video or image processing, openCV is a good choice
it include many functions video processing would need
histogram, image filtering, augmented image border, interpolation, Geometric Image Transformations
Motion Analysis and Object Tracking, motion vector, Camera Calibration, Pose Estimation and Stereo

and other's excitement features waiting for you to explore
Last edited on
Topic archived. No new replies allowed.