pirahansiah commited on
Commit
39a07f8
1 Parent(s): 4abf8e6

update threshodling methods

Browse files
Files changed (2) hide show
  1. app.py +12 -3
  2. threshold_methods.py +2 -2
app.py CHANGED
@@ -1,15 +1,24 @@
 
 
 
 
 
1
  import gradio as gr
2
  from threshold_methods import threshold_methods
3
  import cv2
4
 
5
  new_outputs = [
6
  gr.outputs.Image(type="numpy", label="Output Image"),
7
- gr.outputs.Textbox(type="text", label="My HuggingFace URL")
 
 
8
  ]
9
  def show_image():
10
  img = cv2.imread('huggingface.png')
11
- text = 'https://huggingface.co/spaces/pirahansiah/ComputerVision'
12
- return img,text
 
 
13
 
14
  HuggingFace = gr.Interface(
15
  fn=show_image,
 
1
+ '''
2
+ Sometimes you just want to take an image from your database and see how it changes by running different image processing functions, to find the best starting point for your computer vision application. In this Hugging Face space, I have included various pattern recognition functions that can easily be applied to your input images, so you can see the output of each function. I will continue to update this space with additional modes, methods, and deep learning frameworks/models, to make them easy to use for demonstration purposes. Please let me know if you would like me to include any other specific functionality.
3
+
4
+ '''
5
+
6
  import gradio as gr
7
  from threshold_methods import threshold_methods
8
  import cv2
9
 
10
  new_outputs = [
11
  gr.outputs.Image(type="numpy", label="Output Image"),
12
+ gr.outputs.Textbox(type="text", label="My HuggingFace URL"),
13
+ gr.outputs.Textbox(type="text", label="My linkedin URL"),
14
+ gr.outputs.Textbox(type="text", label="info")
15
  ]
16
  def show_image():
17
  img = cv2.imread('huggingface.png')
18
+ text1 = 'https://huggingface.co/spaces/pirahansiah/ComputerVision'
19
+ text2 = 'https://www.linkedin.com/in/pirahansiah/'
20
+ text3 = ' Sometimes you just want to take an image from your database and see how it changes by running different image processing functions, to find the best starting point for your computer vision application. In this Hugging Face space, I have included various pattern recognition functions that can easily be applied to your input images, so you can see the output of each function. I will continue to update this space with additional modes, methods, and deep learning frameworks/models, to make them easy to use for demonstration purposes. Please let me know if you would like me to include any other specific functionality. '
21
+ return img,text1,text2,text3
22
 
23
  HuggingFace = gr.Interface(
24
  fn=show_image,
threshold_methods.py CHANGED
@@ -29,7 +29,7 @@ def pirahansiah_threshold_method_find_threshold_values_2(grayImg):
29
  th=int(th/mean_psnr)
30
  # Find the threshold values that satisfy the condition
31
  thresh = th #np.argwhere((mean_psnr / k1 < psnr_values) & (psnr_values < mean_psnr / k2)).flatten()
32
- print(th)
33
  return thresh
34
  def pirahansiah_threshold_method_find_threshold_values_1(grayImg):
35
  #https://www.jatit.org/volumes/Vol57No2/4Vol57No2.pdf
@@ -78,7 +78,7 @@ gr.outputs.Image(type="numpy", label="Output Threshold Image")
78
  def process_image(input_image, radio_choice,slider_val):
79
  img = cv2.imread(input_image,0)
80
  binaryImg=img.copy()
81
- print(radio_choice)
82
  if radio_choice == "cv2.threshold(grayImg, 128, 255, cv2.THRESH_BINARY)":
83
  _, binaryImg=cv2.threshold(img, 128, 255, cv2.THRESH_BINARY)
84
  elif radio_choice == "cv2.threshold(grayImg, 128, 255, cv2.THRESH_BINARY_INV)":
 
29
  th=int(th/mean_psnr)
30
  # Find the threshold values that satisfy the condition
31
  thresh = th #np.argwhere((mean_psnr / k1 < psnr_values) & (psnr_values < mean_psnr / k2)).flatten()
32
+ #print(th)
33
  return thresh
34
  def pirahansiah_threshold_method_find_threshold_values_1(grayImg):
35
  #https://www.jatit.org/volumes/Vol57No2/4Vol57No2.pdf
 
78
  def process_image(input_image, radio_choice,slider_val):
79
  img = cv2.imread(input_image,0)
80
  binaryImg=img.copy()
81
+ #print(radio_choice)
82
  if radio_choice == "cv2.threshold(grayImg, 128, 255, cv2.THRESH_BINARY)":
83
  _, binaryImg=cv2.threshold(img, 128, 255, cv2.THRESH_BINARY)
84
  elif radio_choice == "cv2.threshold(grayImg, 128, 255, cv2.THRESH_BINARY_INV)":