开发者

image set collection using python !

I am trying to do some kind of image collection for some research i am currently working on, what i want to do is to have a quicker way to extract the part of interest from thousands of images in an efficient and fast way, my view of the program is that to open continually images and i select the part of interest( as a rectangular object of cars persons .... ) and save it. what i could not figure 开发者_如何学编程out till now is how to be able to select or have kind of selecting tool when images show up. any help with this ?


You'll need a GUI toolkit or a graphics library like Pygame. If you want this to look native, check out the GUI libraries in the Python standard library: http://docs.python.org/2.7/library/tk.html

However, my best area is in Pygame, so that's where I can help you best. Pygame's simple to use, but here are the modules you'll be most concerned about.

  • Use Pygame.mouse to be able to click and drag, pixel by pixel, to decide where you want to crop: http://pygame.org/docs/ref/mouse.html
  • Use Pygame.display to set the window to the relevant images (may not work well depending on image size; scrolling shouldn't be too difficult, though): http://pygame.org/docs/ref/mouse.html
  • Use Pygame.draw to draw the rect highlighting where you've selected: http://pygame.org/docs/ref/draw.html
  • Use Pygame.surface to get the selected image slice: http://pygame.org/docs/ref/surface.html
  • Use Pygame.image to save the selected subsurface: http://pygame.org/docs/ref/image.html

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜