-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfirst_client.py
More file actions
34 lines (27 loc) · 1.08 KB
/
Copy pathfirst_client.py
File metadata and controls
34 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Import required modules
from api.ReconAnom import JSRNet_api
from api.SuperPoint import SuperPoint_api
import cv2
import os
import numpy as np
import matplotlib.pyplot as plt
class first_info():
def __init__(self):
# Instantiate the JSRNet and SuperPoint APIs
self.jsr = JSRNet_api()
self.superpoint = SuperPoint_api()
def extract_one_image(self, img_path, name='0', size=(768, 768)):
# Read the image in color (1 in cv2.imread() stands for color)
query = cv2.imread(img_path, 1)
# Resize the image to the specified size
query = cv2.resize(query, size)
# Prepare inputs for the SuperPoint and JSRNet
# Convert the query image to grayscale for SuperPoint and normalize
sup_inp = cv2.cvtColor(query, cv2.COLOR_BGR2GRAY) / 255.
# Use the color image for JSRNet
jsr_inp = query
# Run the APIs on the inputs
jsr_res = self.jsr.run(jsr_inp)
sup_res = self.superpoint.run_SuperPoint(sup_inp, name)
# Return the results from both APIs
return jsr_res, sup_res