okay, theres a picture, i want the app to find a blue pixel, if there a blue pixel...
okay, theres a picture, i want the app to find a blue pixel, if there a blue pixel...
It depends on the file format ...
you mean jpeg , png... ? ummm.... lets say png
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Also depends on what you define as blue. [0, 0, 255] or anything with b > 128 (for example)?
it is [0,0,255] (blue is just an example, it can be another color but ill just have to modify that
Then you can load the image, create a mapped [0, 0, 255] and search for it in the file... Of course, it gets harder with different formats and palettes etc... Maybe use a library to convert it into an array of color bytes?
If you display the pic on the monitor, then you might have other options.
Every OS knows where the video memory buffer starts and stops. Find that address range, and you can check it directly for a blue value.
No, I haven't done it before, but the program "Dead Pixel Buddy", uses that technique, I'm sure, since there is no picture file being searched.
I don't believe any of these "check the format" answers, are what you want. That's a deep ditch to get out of, imo.
Of course I reckon it might not be very easy to project a full image onto the screen and scan the video buffer.
You can use SDL and SDL_image (the latter one if you want something other than .bmp). It's straightforward.
can't you help me with a code? makes it way easier. Ok let me be clearer 2 lines arent pretty enough:
i want to develop an app, and it loads an image, and scans all the pixels,if the app found example a blue pixel it will say: blue point detected, example.
you need to pick a format, all formats are different .. find its library to work with such files and work with it to get a color byte array.
i recommend libpng