Search code examples
linuxpython-2.7raspberry-pisimplecv

simpleCV in python - show() function displays tiny image on screen


I have followed a basic youtube tutorial to detect white objects with the camera on a Raspberry Pi using the simpleCV framework, coded in python. I have the code running fine but when it displays on screen, its tiny. Approx 60px square. I have tried editing the uv4l-raspicam.conf file to change the display resolution to 640x480 but it has made no difference. I cant even manually make the window on screen bigger. Any help or advice here would be great.

print __doc__

import SimpleCV

display = SimpleCV.Display()
cam = SimpleCV.Camera()
normaldisplay = True

while display.isNotDone():     
    if display.mouseRight:
        normaldisplay = not(normaldisplay)
        print "Display Mode:", "Normal" if normaldisplay else "Segmented"

    img = cam.getImage().flipHorizontal()
    dist = img.colorDistance(SimpleCV.Color.BLACK).dilate(2)
    segmented = dist.stretch(200,255)
    blobs = segmented.findBlobs()

    if blobs:
        circles = blobs.filter([b.isCircle(0.2) for b in blobs])
        if circles:
            img.drawCircle((circles[-1].x, circles[-1].y), circles[-1].radius(),SimpleCV.Color.BLUE,3)

    if normaldisplay:
        img.show()
    else:
        segmented.show()

Solution

  • You can try setting the display size:

    display = SimpleCV.Display((800,600))
    

    If it's still messed up I would confirm the driver is working correctly with another piece of software like cheese:

    > apt-get install cheese
    > cheese