how to make drawing layers part of image data?

asked 2014-02-16 11:48:46 -0500

lala gravatar image


Two key functions from code, where problem might be

def simpleCvImageToQtPixMap(self,img):
        #scvImg =
        data = img.getBitmap().tostring()
        qtImg = QtGui.QImage(data, img.width, img.height, 3 * img.width, QtGui.QImage.Format_RGB888)
        #qtImg = QtGui.QImage(data,img.width,img.height, QtGui.QImage.Format_RGB888)
        pixmap = QtGui.QPixmap()
        return pixmap

def showFinalizedImage(self):

        if (self.procMethod == FindAndDraw.BLOBS):
            b = self.FinalizedImage.findBlobs(threshval = self.spProcBlobThresh.value(),minsize =self.spProcBlobSizeMin.value())
            print ('Blobs found:' + str(len(b)) + " >> " + str(self.spProcBlobThresh.value())+ " >> " + str(self.spProcBlobSizeMin.value()))

            self.FinalizedImage.draw(b,color = Color.RED, width=3)
        elif (self.procMethod == FindAndDraw.CIRCLES):
            print ('circling..')
        pixMap = self.simpleCvImageToQtPixMap(self.FinalizedImage)
        w = self.view3.size().width()
        h = self.view3.size().height()
        self.view3.fitInView(QRectF(0, 0, w, h), Qt.KeepAspectRatio)


studying simplecv. using pyqt. 3 images drawing on qscene / qview. looking good, i can tweak parameters and enjoy


technically, third image (right most) should show me blobs. its not :(. in log, its showing if i try everything in simplecv shell, it works. (showFinalizedImage function). which means problem is first function. which converts image to pixmap. its currently using Image.getBitmap() function. can someone confirm it considers drawing layers or not? if it ignores drawing layers. what is best method to convert drawing layer to Image it self. so basic arithmatic operation can be done?

any ideas?

edit retag flag offensive close merge delete