Grabbing pixel attributes in Python - python-3.x

I am using Python3 on Windows 7. I want to grab all the attributes like color intensity, color etc. Of all the pixels of the screen area that I select with mouse. The selection can be of any shape but right now rectangular and square will do.
I want to do it in any area of the screen.
Can you guys please guide me how to do that in Python?
PS: If the method can work across all the platforms that would be much more appreciated.
Thanks,
Aashiq

You need to use some sort of cross-platform GUI toolkit, such as GTK or KDE, maybe Tk or wx will work as well, I don't know.
How you then do it depends on what toolkit you choose.

Related

How do you create a perfect pygame fullscreen?

I am making a game, and I want it to be fullscreen. However, the pygame fullscreen is strange, creating a screen too large. So I referred to this: Pygame FULLSCREEN Display Flag Creates A Game Screen That Is Too Large For The Screen. However, when I followed these instructions
import ctypes
ctypes.windll.user32.SetProcessDPIAware()
true_res = (ctypes.windll.user32.GetSystemMetrics(0), ctypes.windll.user32.GetSystemMetrics(1))
pygame.display.set_mode(true_res,pygame.FULLSCREEN)
from an answer (but instead using pywin32 instead of ctypes, like this: win32api.GetSystemMetric(0)).
I used this, and while it does create a fullscreen, it also creates a black border around my screen and enlarges everything a slight bit, including my cursor. How can I get rid of this black border and get all shapes to normal size? Or is there a better way to create a good fullscreen?
If it helps, I use Windows 10.
Thanks in advance!
I think the problem of enlarging everything arose with the use of ctypes module as because the ctypes module makes use of a function named as GetSystemMetrics() whose work is to get the size of the screen of your system.
And might be the import pygame is loading some dll that is not compatible with a dll that windll needs.
So I suggest either you update the ctype library or pygame library or update both libraries or you can enlarge screen size by providing custom width and height values according to the resolution supported by your system.
Hope this helps !!

Changing colors in a simple shape editior

I've made a simple shape editor. I can change colors (used to fill shapes) by click on buttons in a menu bar. The disadvangate of this solving is the fact that the numbers of colors are so restricted. I can't find a better solution for my program. Can somebody help me and give me an idea how can I improve it? I thought about color palette, but I have no idea how can I do this.
The image:
("Aktywny kolor" means active colors, and there is the list of colors below, which I can use)
You would need to use a color picker where the colors are distributed on many pixels and not on a very small set of color names. Since you are using applet, you might want to download an already made color picker compatible with your environment, or you might want to write your own, depending on whether the things you find meet your expectations.

Axes on image in IDL

I have an image displayed in an IDL window using the TV command, and would like to add x and y axes to the image. Seems straightforward, but I can't find a way to do it.
Can anyone help with this?
Thanks
Are you tied to direct graphics, i.e., TV? Easiest way to display with axis is to use IMAGE function:
im = image(arr, axis_style=1)
I would echo Mike's answer - go with the new graphics Image function if possible.
If you absolutely have to use direct graphics, then I would recommend using David Fanning's coyote graphics wrappers:
http://www.idlcoyote.com/idldoc/cg/cgimage.html
It's still a lot more work to do this using direct graphics, but at least with the "cg" commands it's easier.

Edit image, using openGL

I have been doing some searching the last couple of days and I have been curious how to do this. I have a UIImagePickerController.
So I want to add a effect like black and white, sepia, etc. I am creating a custom UIImagePickerVController and I am curious. Can this be done with OpenGL ES? If so, how?
This is possible through the use of pixel shaders using OpenGL-ES 2.0. You could also write an Objective-c++ routine that gets all the pixels of your image into an array then applies a custom algorithm to modify the color of the image.
Edit:
Here are some links that might help get you started.
http://www.sunsetlakesoftware.com/2010/10/22/gpu-accelerated-video-processing-mac-and-ios
http://www.dreamincode.net/forums/topic/76816-image-processing-tutorial/
http://www.efg2.com/Lab/Library/ImageProcessing/Algorithms.htm

Detect an object in image using IMAGEMAGICK

I have an image with Gray Background and 'CUP' in center of it... I want to detect the boundaries of the cup in this image.. After detecting CUP I want to extract the CUP from the image using IMAGEMAGICK.. Note I have many images with different objects (like CUP) in the center and with different background color .. So I am looking for a solution which is applicable to all of them..
Plz comment..
Maybe you could use edge-detection algorithms to isolate the shape of your main object: http://en.wikipedia.org/wiki/Edge_detection
You could also look into the code for the EdgeImage effect in ImageMagick, to see how they do it...

Resources