how to make drawing layers part of image data?

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

lala gravatar image

problem

Two key functions from code, where problem might be

def simpleCvImageToQtPixMap(self,img):
        #scvImg = self.cam.getImage()
        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()
        pixmap.convertFromImage(qtImg.rgbSwapped())
        return pixmap

def showFinalizedImage(self):
        self.scene3.clear()

        if (self.procMethod == FindAndDraw.BLOBS):
            #Utils.findBlobsInImage(self.FinalizedImage,self.spProcBlobThresh.value(),self.spProcBlobSizeMin.value(),self.spProcBlobSizeMax.value())
            #self.FinalizedImage.clearLayers()
            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)
            self.FinalizedImage.applyLayers()
        elif (self.procMethod == FindAndDraw.CIRCLES):
            print ('circling..')
        pixMap = self.simpleCvImageToQtPixMap(self.FinalizedImage)
        w = self.view3.size().width()
        h = self.view3.size().height()
        self.scene3.addPixmap(pixMap)
        self.view3.fitInView(QRectF(0, 0, w, h), Qt.KeepAspectRatio)
        self.scene3.update()

information

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

status

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