The new ginput function is great.
Would it be possible to have a version that looks to the user like a
RectangleSelector widget but works for the programmer like ginput? That is,
it returns the coordinates of the rectangle.
This would be really useful for implementing a user image crop function,
similar to matlab's imcrop for example.
One can functionally do this with:
import os.path, sys
import pylab
import Image
img = Image.open('test_image.png')
fig = pylab.imshow(img, origin='lower')
print "Please click on top left, bottom right of crop area"
x = pylab.ginput(2)
#PIL and matplotlib have different origin
roi = img.crop([int(x[0][0]),int(img.size[1]-x[0][1]),
int(x[1][0]),int(img.size[1]-x[1][1])])
filenm = os.path.join(sys.path[0], 'crop_image.png')
roi.save(filenm)
show()
But users expect a rectangle for cropping.
I've had a look a the BlockingMouseInput class but its all a bit beyond me
at the moment.
Eleanor
--
View this message in context:
http://www.nabble.com/Feature-Request%3A-RectangleSelector-BlockingInput-tp18841798p18841798.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users