3 Attachment(s)
there is a way for qt to image mosaicking?
hi , smart qter ! there is two picture a image & b image. and i got the image like c image . is a way for to get it ?
eg:
a image
Attachment 11638
b image
Attachment 11639
c image
Attachment 11640
if there is a way , please tell me !
thks much for your kinds !
by
poor huifeidmeng
Re: there is a way for qt to image mosaicking?
It is not clear at all what you are asking. Do you want to take two separate images and put them side-by-side in a single image? Do you want to take a side-by-side image and break it into two separate images? Look at the documentation for QImage.
Re: there is a way for qt to image mosaicking?
Code:
QImage aImage
("aImg.png");
// say size = 40x40 QImage bImage
("bImg.png");
// say size = 70x40
To mosaick:
1. Create an image with the appropriate size.
Code:
QImage cImage
(110,
40,
QImage::Format_RGB32);
// say size = 40x40
2. Read pixel data from aImage and bImage and store it in appropriate positions in cImage. This can be done by scanning line by line using QImage::scanLine().
Example, to copy 0th pixel of a specific row from bImage to cImage:
Code:
QRgb* bImgLine = (QRgb*)bImage.scanLine(row);
QRgb* cImgLine = (QRgb*)cImage.scanLine(row);
*(cImgLine+40) = *(bImgLine+0);
Re: there is a way for qt to image mosaicking?
Quote:
Originally Posted by
Vikram.Saralaya
Example, to copy 0th pixel of a specific row from bImage to cImage:
Code:
QRgb* bImgLine = (QRgb*)bImage.scanLine(row);
QRgb* cImgLine = (QRgb*)cImage.scanLine(row);
*(cImgLine+40) = *(bImgLine+0);
Be careful, your code assumes that bImage has the same format as cImage (QImage::Format_RGB32). You should convert bImage to that format first.