2012년 3월 19일 월요일

[opencv] ROI

crop으로 검색해서 나옴

http://nashruddin.com/OpenCV_Region_of_Interest_(ROI)

todo

  • python 으로 일단은 해보기
  • 매칭관련해서 공부해보기

2012년 3월 17일 토요일

opencv python

opencv, numpy 설치시

cv2 : c++ 바인드, 가장 최신
cv : c 바인드, 예전 버젼

이미지 로우딩 :
import cv2,cv
im = cv2.imread("file.jpg")
im : numpy.ndarray 로 return

src: numpy.ndarray
grey_src = cv2.cvtColor(src : numpy.ndarray, cv.CV_RGB2GRAY)
grey_src : numpy.ndarray

이미지 저장 :
import cv2
cv2.imwrite("파일명", numpy.ndarry=> 위의 im 같은값)

2012년 3월 16일 금요일

python gif to jpg

from Image
im = Image.open("fromfile")
rgb = im.convert("RGB")
rgb.save("tofile")


sicp 2.59


#lang racket
(define (element-of-set? x set)
  (cond ((null? set) false)
        ((equal? x (car set)) true)
        (else (element-of-set? x (cdr set)))))

(define (adjoin-set x set)
  (if (element-of-set? x set)
      set
      (cons x set)))

(define (intersection-set set1 set2)
  (cond ((or (null? set1) (null? set2)) '())
        ((element-of-set? (car set1) set2)      
         (cons (car set1)
               (intersection-set (cdr set1) set2)))
        (else (intersection-set (cdr set1) set2))))


;; 2.59
(define (union-set set1 set2)
  (cond ((null? set1) set2)
        ((element-of-set? (car set1) set2)      
         (cons (car set1)
               (union-set (cdr set1) (cdr set2))))
        (else (cons (car set1) (union-set (cdr set1) set2)))))

(union-set '(1 2 3 4) '(2 3 4))