2019년 9월 21일 토요일

우드잡

주인공 히라노 유키역의 소메타니 쇼타의 능청스러운 연기 일품으로  너무 밋밋해질 수도 있는 스토리를 맛깔나게 이끌어 나가는 역할을 해낸다.

'우에~'

리드미컬한 그 탄성...

2019년 9월 20일 금요일

붉은 색 글자를 찾아서 1


chaejoo@lifentech.com

image_bgr = cv2.imread(image_file)
img_hsv_h = image_hsv[:, :, 0]
img_hsv_s = image_hsv[:, :, 1]
img_hsv_v = image_hsv[:, :, 2]

lower_red1 = (0.95*180, 0.4*255*0.6,        0)
upper_red1 = (180,              255, 0.97*255)
lower_red2 = (0,        0.4*255*0.6,        0)
upper_red2 = (0.1*180,  255,         0.97*255)

img_hsv = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2HSV)
img_hsv1 = cv2.inRange(img_hsv, lower_red1, upper_red1)
img_hsv2 = cv2.inRange(img_hsv, lower_red2, upper_red2)
img_red = cv2.bitwise_or(img_hsv1, img_hsv2)

#Clear up by getting rid of particles less than 400 pixels in area.
imge_red = baweraopen(img_red,4000)
imge_red = imge_red - baweraopen(imge_red,19000)
# and remove bigsize
# Fill any holes in the blobs.
imge_red = img_fill(imge_red, 127)
cv2.imshow('IMG', imge_red)
cv2.waitKey(0)

2019년 9월 19일 목요일

적외선 온도계 IR-22 통신 사용방법

IR-22 비접촉 온도계는 485통신이 된다.

보통 9600 속도로 설정되어 있어.

0x02 0x30 0x31 0x52 0x30 0x03 0x62

STX+'0'+'1'(국번)+'R'+'0'+ETX+BCC

응답은
   STX+'0'+'1'+'R'|0x80+'0'+ x30 + x31 + x30 + x3F + ETX + BCC
이다.

  그럼  x30 + x31 + x30 + x3F  ==  x010F 와 같다.

temp = 0*16^3+1*16^2+0*16+F = 256+15 = 271  이여서 27.1 도 가 된다.

  x00FA = 15*16 + 10 = 250  이면  25도 임.


  xFED4 = 65236 - 65535 - 1 = -30 도임.

          32767 보다 크면  영하임.

printf deg C를 해보자.

" -> %s\xB0 C " works. The printout is: 18.4° C

But " -> %s\xB0C " does not work. The printout then is: 18.4

The blank between \xB0 and C is necessary! And this is acceptable.

2018년 9월 27일 목요일

기계시각의 이미지 프로세싱 #001

1. 영상의 이진화

    임계값, threshold, 문턱값, 기준값을 이용하여 영상의 모든 픽셀을 검사하여 문턱값보다 높을 경우 1, 낮을 경우 0 으로 하는 이진 영상(binary image)를 만들어 내는 것. 매트랩에서는 영상의 이진화를 im2bw 라는 함수를 이용하여 간단히 수행.

img = imread('2.bmp');
BW = im2bw(img,0.5);  ! 0.5 = 127.5 값
s  = regionprops(BW,'centroid');
centroids = cat(1, s.Centroid);
imshow(BW);
hold on;
plot(centroids(:,1), centroids(:,2), 'b*');
hold off;



2.  영상 이진화(binarization, thresholding)
   영상의 밝기 분포를 보고 임계값을 찾아주는 방법 Otzu's method (N. Otsu, “A threshold selection method from gray-level histograms,” IEEE Trans. Syst., Man, Cybern., vol. SMC-9, pp. 62-66, 1979).   임계값을 0-255까지 변화시켜  밝기평균의 차의 제곱의 최대값을 찾는 방법.