1 Attachment(s)
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.
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.
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.
Re: How to copy selected ellipse area from image
Hi,
I think that QGraphicsView can help you.
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.
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.