Ask Your Question

The converted image rotate, trying using rotate or transpose don't fix it

asked 2014-09-11 03:16:58 -0500

Andrew1108 gravatar image

Hello this first time for me using SimpleCV: I got problem, when I convert opencv image to simplecv image, it's rotated.. I try using rotate, and flip, but command findBlobs won't work if I using rotated image.. I'm trying these solution here but didn't work too.. Here my code:

bgsMOG = cv2.BackgroundSubtractorMOG2()
cap    = cv2.VideoCapture("d:\1.avi")
if cap:
    while True:
        ret, frame =

        if ret:
            fgmask     = bgsMOG.apply(frame, None, 0.01)
            simplecvimg= Image(fgmask, cv2image=True)
            asli       = Image(frame, cv2image=True)

            blobs      = simplecvimg.findBlobs()
            if blobs is not None:
            car_bounding_box = blobs[0].boundingBox()            
            blobs[-1].drawRect(color=(0,255,0), width=1,alpha=128) #128

What should I do to rotate the simplecv image and how to resize the window in Thanks for your help..

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2014-09-13 09:25:48 -0500

i make

Image to be Treated:

image description

Image after disinclination:

image description

Binarized image:

image description

Final Picture With Optical Character Recognition:

image description

# -*- coding: utf-8 -*-

from SimpleCV import *
import time

img = Image("ret.png")

blobs = img.findBlobs()
print "Objetos Encontrados --> %i\n" % (len(blobs))
if blobs:
    blobs = blobs[-1]
    print "Angulo do Objeto --> %i\n" % (blobs.angle())
    print "Aplicando rotação para desinclinação da imagem!"
    img = img.smartRotate()   
    bin = img.binarize()
    text = bin.readText()[:-5]
    if text:
        string = "Texto reconhecido da Imagem:-->%s" % (text)

hope this helps you, sorry but my English is not very good

edit flag offensive delete link more


umm actually, what is different blobs[-1] and blobs[0]?? Sorry if my question is noob..

Andrew1108 gravatar imageAndrew1108 ( 2014-09-17 06:51:55 -0500 )edit

And how I can make window size is actual size of video?? My video is cropped into rectangle, the real size is width=320 and height=180

Andrew1108 gravatar imageAndrew1108 ( 2014-09-17 06:54:08 -0500 )edit

answered 2014-09-17 09:42:21 -0500

updated 2014-09-17 09:47:23 -0500

blob [-1] gets the biggest blob of the list blob[0] simply takes the blob position 0 of the list to specify the size of the screen you can use the function scale(x, y)


edit flag offensive delete link more


thank you very much :)

Andrew1108 gravatar imageAndrew1108 ( 2014-09-17 12:18:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-09-11 03:16:58 -0500

Seen: 592 times

Last updated: Sep 17 '14