Results 1 to 6 of 6

Thread: How to copy selected ellipse area from image

  1. #1
    Join Date
    Jul 2009
    Posts
    4
    Thanks
    1

    Default How to copy selected ellipse area from image

    Hi guys
    I'm developing a program for image prosessing. I want to copy selected ellipse area on image. How can i do this. I developed a program which draw an ellipse on image when mouse move.
    The problem i want to copy this area. How can i copy? QImage has a copy function but this is for rectangle not ellipse. How can i copy ellipse area. I put image what i did.
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to copy selected ellipse area from image

    Hi,

    You can't really create an elliptic image because it's only possible to save rectangle images.
    You can use QImage QImage::copy(const QRect& rectangle = QRect()) const with the bounding rectangle of the ellipse. Then in the obtained image you can paint the outside pixels with black color. It's only an idea.
    Òscar Llarch i Galán

  3. The following user says thank you to ^NyAw^ for this useful post:

    adamsakli (24th September 2009)

  4. #3
    Join Date
    Jul 2009
    Posts
    4
    Thanks
    1

    Default Re: How to copy selected ellipse area from image

    Thanks for reply ^NyAw^.
    But image prossesing program like GIMP, Adobe photoshop do this. I can select ellipse area and can copy this area from image and paste anywhere i want. I want to do like on GIMP and Photosshop.

  5. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to copy selected ellipse area from image

    Hi,

    I think that QGraphicsView can help you.
    Òscar Llarch i Galán

  6. #5
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to copy selected ellipse area from image

    Going further in the direction of copying rectangles, you can then set a mask to your image, by drawing in a QBitmap an ellipse of the same size.

  7. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to copy selected ellipse area from image

    I think you can try this -
    copy the rectangle from the image which bounds the ellipse. Then traverse the rect and set the pixels transparent which are not in ellipse.
    This might not be very efficient but you can optimise or look for some fast algo for determining points inside a ellipse. HINT : you can check the border areas,,, ellipse will cover most of the inner area.

Similar Threads

  1. How to copy sellected ellipse area from image
    By adamsakli in forum Newbie
    Replies: 2
    Last Post: 24th September 2009, 22:11
  2. Selection area on image
    By sdwdd in forum Newbie
    Replies: 2
    Last Post: 5th March 2009, 11:09
  3. Replies: 3
    Last Post: 11th March 2007, 13:04
  4. displaying png image for a given area..
    By sar_van81 in forum Qt Programming
    Replies: 1
    Last Post: 17th January 2007, 13:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.