Exemplo n.º 1
0
    def imagesc(self,im, clims=None):
        """
        Display a normalized version of the image
        """
        if(self.currentWindow==-1):
            self.display()

        # don't normalize multichannel image
        #if(im.nChannels>1):
        #    if(im.depth!=cv.IPL_DEPTH_8U):
        #        im2 = cvCreateImage( cvSize(im.width, im.height), cv.IPL_DEPTH_8U, im.nChannels)
        #        cvScale(im, im2)
        #        im = im2
        #    cvShowImage(self.currentWindowName, im)
        #    return self.currentWindow
        
        # normalize image
        if clims:
            [minv, maxv] = clims
        else:
            [minv,maxv] = cvMinMaxLoc(im)
        if maxv != minv:
            s = 255.0/(maxv-minv)
            shift =  255*(-minv)/(maxv-minv)
        else:
            s = 1.0
            shift = -maxv

        im2 = array( size(im), 'uint8' )
        cvConvertScale(im, im2, s, shift)
        
        cvShowImage(self.currentWindowName, im2)
Exemplo n.º 2
0
    def imagesc(self, im, clims=None):
        """
        Display a normalized version of the image
        """
        if (self.currentWindow == -1):
            self.display()

        # don't normalize multichannel image
        #if(im.nChannels>1):
        #    if(im.depth!=cv.IPL_DEPTH_8U):
        #        im2 = cvCreateImage( cvSize(im.width, im.height), cv.IPL_DEPTH_8U, im.nChannels)
        #        cvScale(im, im2)
        #        im = im2
        #    cvShowImage(self.currentWindowName, im)
        #    return self.currentWindow

        # normalize image
        if clims:
            [minv, maxv] = clims
        else:
            [minv, maxv] = cvMinMaxLoc(im)
        if maxv != minv:
            s = 255.0 / (maxv - minv)
            shift = 255 * (-minv) / (maxv - minv)
        else:
            s = 1.0
            shift = -maxv

        im2 = array(size(im), 'uint8')
        cvConvertScale(im, im2, s, shift)

        cvShowImage(self.currentWindowName, im2)
Exemplo n.º 3
0
    def image(self, im):
        """
        Display image as is -- probably not what you'd expect for FP or integer images
        """
        if(self.currentWindow==-1):
            self.display()

        cvShowImage(self.currentWindowName,im)
        return self.currentWindow
Exemplo n.º 4
0
    def image(self, im):
        """
        Display image as is -- probably not what you'd expect for FP or integer images
        """
        if (self.currentWindow == -1):
            self.display()

        cvShowImage(self.currentWindowName, im)
        return self.currentWindow
Exemplo n.º 5
0
import sys
import cv
import highgui

filename="../resources/test.tiff"
print " Loading \"", filename, "\""
im = highgui.cvLoadImage(filename);
highgui.cvNamedWindow("Window", 1);
highgui.cvShowImage("Window", im);
highgui.cvWaitKey();

Exemplo n.º 6
0
 def show(self, name, image, callback=None, foreground=True):
     self._ensurewindow(name, foreground)
     hg.cvShowImage(name, image)
     if callback is not None:
         hg.cvSetMouseCallback(name, callback, image)
Exemplo n.º 7
0
 def ShowImage(self, name, image):
     hg.cvShowImage(name, image)