def inner_discrimination(self):
        print(self.interest_list)
        sc.split_coord1(self.interest_list, self.interest_xy)
        print(self.sensor_pos)
        sc.split_coord1(self.sensor_pos, self.sensor_pos_xy)

        for i in self.sensor_pos_xy:
            count = 0
            for j in range(len(self.interest_xy)):
                if (j == len(self.interest_xy) - 1):
                    if (self.interest_xy[j][1] <= i[1] <=
                            self.interest_xy[0][1]) or (
                                self.interest_xy[j][1] >= i[1] >=
                                self.interest_xy[0][1]):
                        if self.left_discrimination(self.interest_xy[j][0],
                                                    self.interest_xy[j][1],
                                                    self.interest_xy[0][0],
                                                    self.interest_xy[0][1],
                                                    i[0], i[1]) == 1:
                            count = count + 1

                else:
                    if (self.interest_xy[j][1] <= i[1] <=
                            self.interest_xy[j + 1][1]) or (
                                self.interest_xy[j][1] >= i[1] >=
                                self.interest_xy[j + 1][1]):
                        if self.left_discrimination(self.interest_xy[j][0],
                                                    self.interest_xy[j][1],
                                                    self.interest_xy[j + 1][0],
                                                    self.interest_xy[j + 1][1],
                                                    i[0], i[1]) == 1:
                            count = count + 1

            if exit == 1:
                print('경계면')
                print('센서가 관심영역 밖에 있습니다')
                return 1

            if count % 2 == 0:
                print('센서가 관심영역 밖에 있습니다')
                return 1
            else:
                print('센서가 배치되었습니다.')
                return 2
Esempio n. 2
0
import convert_png as cp
import split_area_main as sa
import make_sensor as msp
import save_png_main as spm
import split_coordinate as sc

#변하지 않는 값
total_pixel_of_interest = 100000
#area_of_interest_list = []
'''
area_of_interest_list.append((286,39))
area_of_interest_list.append((515,408))
area_of_interest_list.append((58,410))
'''
area_of_interest_list = []
sc.split_coord1(input("관심영역의 좌표를 입력하시오.").split(' '),
                area_of_interest_list)  #관심영역 좌표 리스트
print(area_of_interest_list)
detect_range = int(input("센서의 탐지범위를 입력하시오.\n"))  #센서 탐지범위

#변하는 값(초기값)
sensor_number = 6  #센서 갯수 -> 추후 변경
max_coverage_percent = 0  #가장 큰 커버율 -> 이 커버율이 100퍼센트가 되면 종료
max_coverage_percent_section = 0  #section의 커버율이

#코드 진행
basic_png = spm.start(area_of_interest_list, [], detect_range)
basic_png.save_png()
cp.convert("image_test0.png", total_pixel_of_interest)

#boundary_list = sa.splitList(sa.getContour(sensor_number))
Esempio n. 3
0
colony_number = 10
detect_range = 90
area_of_interest_list = []

################################################################

for i in area_of_interest:
    area_of_interest_split = i.split(',')
    cordxlist.append(area_of_interest_split[0])
    cordylist.append(area_of_interest_split[1])

#군집 n개 만들기
colonylist = []

for i in range(0, colony_number):
    test = []
    for j in range(sensornumber):
        k = mc.make_coord(test, cordxlist, cordylist)

    colonylist.append(k)

sc.split_coord1(area_of_interest, area_of_interest_list)
spa = sp.start(area_of_interest_list, colonylist[0], detect_range)

for i in range(0, 10):
    spa = sp.start(area_of_interest_list, colonylist[i], detect_range)

    #globals()['sp'.format(i)] = sp.start(area_of_interest_list, colonylist[i], detect_range)

#sp.start()
Esempio n. 4
0
import random_move
import numpy as np
import copy
from random import *

sensorxy = []
T_init = 60
T_final = 1
T = copy.deepcopy(T_init)
parameter = 10
n = 0.99

area_of_interest_list = []
#sc.split_coord1(input("관심영역의 좌표를 입력하시오.").split(' '), area_of_interest_list) #관심영역 좌표 리스트
#입력 예시 지금은 정삼각형만 입력해야함 (200,200) (600,200) (400,540)           // (286,39) (515,408) (58,410)
sc.split_coord1(("(200,200) (600,200) (400,540)").split(' '),
                area_of_interest_list)

#detect_range = int(input("센서의 탐지범위를 입력하시오.\n")) #센서 탐지범위
detect_range = 50
#변하는 값(초기값)
sensor_number = 6
length = 9  #move의 숫자열 길이
move = []  #예시=[[0,1,0,0,1,0,0,1,1],[1,0,0,1,0,0,1,0,1]]
tempmove = []
sensor = []  #예시=[[100,200],[200,300]]
tempsensor = []
param = 0
count = 0

#관심영역의 총 픽셀 계산
basic_png = spm.start(area_of_interest_list, [], detect_range)