Пример #1
0
 def __init__(self, name, workspace, nb_cores, request_file, error_file, log_file):
     #Nom
     self.name = name
     #Nombre de coeur
     self.nb_cores = nb_cores
     #Image
     self.img = image(workspace, self.name, self.nb_cores)
     #Enregistrement des noms de fichiers
     self.error_file_name = error_file
     self.valid_request_file_name = request_file
     self.log_file_name = log_file
     self.campaign_info_file_name = "README"
     
     #Deplacement dans le dossier de travail dans un dossier du nom de l'operation
     try:
         os.chdir(workspace)
     except:
         print("Probleme de workspace dans le moniteur")
         
     #Vidage fichiers valid_request et error
     request_file = open("./"+self.valid_request_file_name+"_"+str(self.name),"w")
     request_file.write("")
     request_file.close()
     request_file = open("./"+self.error_file_name+"_"+str(self.name),"w")
     request_file.write("")
     request_file.close()
Пример #2
0
    def __init__(self, root):
        self.root = root

        frame = Frame(root, width=1800, height=1400)
        frame.pack(side=TOP, fill=X)
        root.geometry("1000x600")
        root.title("Text Extractor & Analyzer ")

        self.image_photo = tk.PhotoImage(file='Image.png')
        self.image_button = Button(frame,
                                   width=300,
                                   height=300,
                                   text="Image",
                                   font='Helvetica 18 bold',
                                   image=self.image_photo,
                                   bg="skyblue",
                                   fg='red',
                                   compound=TOP,
                                   command=lambda: image(root))
        self.image_button.pack(side=tk.LEFT, padx=2, pady=2)
        self.image_button.image = self.image_photo

        self.audio_photo = tk.PhotoImage(file='audio.png')
        self.audio_button = Button(frame,
                                   width=300,
                                   height=300,
                                   text="Audio",
                                   font='Helvetica 18 bold',
                                   image=self.audio_photo,
                                   bg="skyblue",
                                   fg='red',
                                   compound=TOP,
                                   command=lambda: audio(root))
        self.audio_button.pack(side=tk.LEFT, padx=2, pady=2)
        self.audio_button.image = self.audio_photo

        self.video_photo = tk.PhotoImage(file='video.png')
        self.video_button = Button(frame,
                                   width=300,
                                   height=300,
                                   text="Video",
                                   font='Helvetica 18 bold',
                                   image=self.video_photo,
                                   bg="skyblue",
                                   fg='red',
                                   compound=TOP)
        self.video_button.pack(side=tk.LEFT, padx=2, pady=2)
        self.video_button.image = self.video_photo
Пример #3
0
def main():
    get_user_input()
    text()
    image()
Пример #4
0
# random images url
url = "https://alpha.wallhaven.cc/random?page=1"

# getting the document behind the url | requests
response = requests.get(url)

# code from content
text = response.text

# beautifying the code
soup = BeautifulSoup(text, 'html.parser')

# getting out the images' thumbnails for evaluation
# for link in soup.find_all('img'):
# 	# source for all the thumbnails
# 	src = link.get('data-src')

# we are getting late, so I'll pick the
# the first image of the page
for link in soup.find_all('a', {"class": "preview"}, limit=1):
    src = link.get('href')
    print src

# ================ evaluating the images on wallhaven ============================

# ================ setting up text on the image ==================================

# as of now we have only one image coming through.
# lets overlay text on the image
image(src)
Пример #5
0
path_to_features = ['../../../data/011_Quant.csv']
channel_list = ['ER', 'PR', 'HER2']

image_shape = (2048, 2048)
path = {'images': path_to_images, 'features': path_to_features}
file_name = {'images': 'image_names', 'feature': 'feature_name'}
im_type_info = {
    'path': path,
    'file_name': file_name,
    'channel_list': channel_list,
    'image_shape': image_shape
}

image_info = {Strings.IF: im_type_info}

ip = ImageProvider(image_info)

im = ip.generate_image_obj()
values = im.images[Strings.IF][:, :, :]
# values = np.append(values, np.ones((2048, 2048, 1)),axis=2)
test = np.empty((1, 2048, 2048, 3))
test[0, :, :, :] = values
plt.imshow(im.images[Strings.IF][:, :, :])
# plt.show()

i = td.images.fromarray(test)
print i
image(i.first())

# show_subset_patches(im, (5,5))
Пример #6
0
image_shape = (2048, 2048)
path = {'images': path_to_images,
        'features': path_to_features}
file_name = {'images': 'image_names',
             'feature': 'feature_name'}
im_type_info = {'path': path,
                'file_name': file_name,
                'channel_list': channel_list,
                'image_shape': image_shape}

image_info = {Strings.IF: im_type_info}

ip = ImageProvider(image_info)

im = ip.generate_image_obj()
values = im.images[Strings.IF][:, :, :]
# values = np.append(values, np.ones((2048, 2048, 1)),axis=2)
test = np.empty((1, 2048, 2048, 3))
test[0,:, :, :] = values
plt.imshow(im.images[Strings.IF][:, :, :])
# plt.show()

i = td.images.fromarray(test)
print i
image(i.first())



# show_subset_patches(im, (5,5))
Пример #7
0
def main():
    img = cv2.imread('../images/isolated_images/6.jpg')
    im = image(img)
Пример #8
0
]

food = [screen_height / 2, screen_width / 2]
window.addch(int(food[0]), int(food[1]), curses.ACS_LANTERN)

key = curses.KEY_RIGHT

while True:
    next_key = window.getch()
    key = key if next_key == -1 else next_key

    if snake[0][0] in [0, screen_height] or snake[0][1] in [
            0, screen_width
    ] or snake[0] in snake[1:]:
        import image
        image()
        quit()

    new_snake_head = [snake[0][0], snake[0][1]]

    if key == curses.KEY_DOWN:
        new_snake_head[0] += 1
    if key == curses.KEY_UP:
        new_snake_head[0] -= 1
    if key == curses.KEY_LEFT:
        new_snake_head[1] -= 1
    if key == curses.KEY_RIGHT:
        new_snake_head[1] += 1

    snake.insert(0, new_snake_head)
Пример #9
0
    def _build_dictionary(_Self, _Debug=False):
        _Directory = _Self.m_directory

        _Files = os.listdir(_Directory)

        for _File in _Files:

            if _File[0] == "." or _File == "..":
                continue  # skip the local directory or the directory above

            ###################################################
            # Convert forward slashes for Windows portability
            ###################################################
            if os.name is "nt" and _Directory[-1] != "/":

                _Directory = _Directory + "\\"

                _Directory = _Directory.replace("\\", "/")

            if _Debug is True:
                print _Directory + _File

            _Path = _Directory + _File

            if os.path.islink(_Path):
                _Path = os.path.realpath(_Path)

            if os.path.isfile(_Path):
                _Image = Image.open(_Path)

            else:
                continue

            ######################################################
            # image.py for class declaration
            ######################################################
            _InImage = image(_File)

            ######################################################
            # Store the image names
            ######################################################
            _Self.m_image_names.append(_InImage.m_name)

            _Self.m_stored_pictures[_InImage.m_name] = _InImage

            _Width, _Height = _Image.size

            _TempWidth = 0

            _TempHeight = 0

            ######################################################
            # Default size
            ######################################################
            _Offset = 20

            _SecondTime = False

            _SecondTimeWidth = False

            while True:

                _Left = _TempWidth

                _Top = _TempHeight

                _NewSize = [_Left, _Top, _Left + _Offset, _Top + _Offset]

                if (_NewSize[2] < _Width) and (_NewSize[3] < _Height):

                    _NewPicture = _Image.crop(_NewSize)

                    _Hash = hashlib.md5(_NewPicture.tostring()).hexdigest()

                    ################################################
                    # Check if dictionary contains the hash value
                    ################################################
                    if len(_Self.m_hashes[_Hash]) is not 0:

                        # _HObjects = [_Item.m_image for _Item in _Self.m_hashes[_Hash]]

                        if _InImage in _Self.m_hash_images:
                            _HashMember = _Self.m_hashes[_Hash]

                            _FoundSetMember = None

                            _SetMember = None

                            for _SetMember in _HashMember:

                                if _SetMember.m_image is _InImage:

                                    _FoundSetMember = _SetMember

                                    break

                            _FoundSetMember.m_count += 1

                            _InImage.m_picture_size += 1

                            if _FoundSetMember not in _Self.m_multiple_hashes:

                                _Self.m_multiple_hashes[_FoundSetMember] = _FoundSetMember

                            _HashMember.discard(_FoundSetMember)

                            _Self.m_hash_images[_InImage].discard(_FoundSetMember)

                            _HashMember.add(_FoundSetMember)

                            _Self.m_hash_images[_InImage].add(_FoundSetMember)

                        else:
                            #############################################
                            # Add a new image at the hash's location
                            #############################################

                            _Object = hash_object(_InImage)

                            _Self.m_hashes[_Hash].add(_Object)

                            _Self.m_hash_images[_InImage].add(_Object)

                            _InImage.m_picture_size += 1

                            _InImage.m_pictures.append(_Hash)

                    else:
                        ################################################
                        # Add a new set at the hash's location
                        ################################################

                        _Self.m_hashes[_Hash].add(hash_object(_InImage))

                        _Self.m_hash_images[_InImage].add(hash_object(_InImage))

                        ###################################################
                        # Store all of the hashes of that image inside that
                        # image object
                        ###################################################
                        _InImage.m_pictures.append(_Hash)

                        _InImage.m_picture_size += 1

                _TempWidth = _TempWidth + _Offset

                if _TempWidth > _Width:

                    _TempWidth = 0

                    _TempHeight = _TempHeight + _Offset

                if _TempHeight >= _Height:

                    break
Пример #10
0
def build_dictionary(_Directory):

   _Files = os.listdir(_Directory)

   for _File in _Files:

      if _File[0] == '.': continue

      _Image = Image.open(_Directory + _File)

      _InImage = image(_File)

      _ImageNames.append(_InImage.m_name)

      _StoredPictures[_InImage.m_name] = _InImage

      _Width, _Height = _Image.size

      _TempWidth = 0

      _TempHeight = 0

      _Offset = 30

      _SecondTime = False

      _SecondTimeWidth = False

      while True:

         _Left = _TempWidth

         _Top = _TempHeight

         _NewSize = [_Left, _Top, _Left + _Offset, _Top + _Offset]

         if (_NewSize[2] > _Width): _NewSize[2] = _Width

         if (_NewSize[3] > _Height): _NewSize[3] = _Height

         _NewPicture = _Image.crop(_NewSize)

         _Hash = hashlib.md5(_NewPicture.tostring()).hexdigest()

         try:
            
            _Hashes[_Hash]

            _Hashes[_Hash].append(_InImage)

         except:
 
            _Hashes[_Hash] = list().append(_InImage)

         _InImage.m_pictures.append(_Hash)

         _TempWidth = _TempWidth + _Offset

         if (_TempWidth > _Width):

            _TempWidth = 0

            _TempHeight = _TempHeight + _Offset

         if (_TempHeight >= _Height):

            break