Crop image in required shape other than rectangle
-
HI,
How to crop a image in Qt by marking points on image. As i found cropping based on rectangle only (cropped and taken bytearray of cropped image).
Thank you.
-
Thank you @jsulm
my requirement is to crop the image for example ball (in circle shape), banana (curved shape). Shape may vary based on Object at run time. Some thing like photo shop has a feature of cropping based on marking points. -
Thank you @jsulm
my requirement is to crop the image for example ball (in circle shape), banana (curved shape). Shape may vary based on Object at run time. Some thing like photo shop has a feature of cropping based on marking points. -
Create a mask
QImage mask(baseImage.size(),QImage::Format_MonoLSB);
or use one of the available methods to get the mask (http://doc.qt.io/qt-5/qimage.html#createHeuristicMask, http://doc.qt.io/qt-5/qimage.html#createMaskFromColor) then iterate through every pixel and "delete" (baseImage.setPixelColor(x,y,Qt::transparent);
?) those that have a 0 in the mask