Beispiel #1
0
from PIL import Image
import os
from pylab import *
from src.WeiboPoster import *
from src.ImageGetter import *

im = array(Image.open('radar_image\\115.bmp').convert('RGB'))
#imc = array(Image.open('radar_image\Shanghai_calbirate.bmp'))
print im.shape, im.dtype
weibo = WeiboPoster()
pil_im = Image.fromarray(uint8(im))
pil_im.save("test.jpg")
imgGet = ImageGetter()
weibo.post_weibo_with_image("test with a pic",imgGet.convert_to_binary_file_stream(pil_im,"jpg"))
r = im[:,:,0]
g = im[:,:,1]
b = im[:,:,2]
figure()
imshow(r)
show()
figure()
imshow(g)
show()
figure()
imshow(b)
show()

print r
print g
print b
(height,weight) = r.shape
Beispiel #2
0
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-

__version__ = "0.3"
__author__ = "Matthew ([email protected])"

from src.ImageGetter import *
from src.ImageAnalyzer import *
from src.WeiboPoster import *
import time

if __name__ == "__main__":

    status = "Clear"
    img_get = ImageGetter()
    img_analyzer = ImageAnalyzer()

    while True:
        try:
            img_data = img_get.get_radar_img("http://www.nmc.cn/publish/radar/qingpu.html")

            img_analyzer.set_region((235, 185, 330, 274))
            cropped_img = img_analyzer.crop_image(img_data)

            img_analyzer.set_region((37, 32, 46, 37))
            cropped_img2 = img_analyzer.crop_image(cropped_img)

            result = img_analyzer.analysis_image(cropped_img2)
            print("Check result: " + result)

            if status != result: