Python Forum
How to mask the region out side the region of interest
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to mask the region out side the region of interest
#1
Hi,
I have below the circle, and I want to pick three regions of interest.

I created a filled circle with center at (0,0), a radius is 20. Now I want to select four ROI (region of interest) and mask the region outside the ROI with black color

ROI 1: A semicircle with center at (0,0), and with radius 5 (to the right side, meaning opened to right side)
ROI 2: A semicircle with center at (0,0), and with radius 5 (to the left side, meaning open to the left side)
ROI 3: A semicircle with center at (0,0), and with radius 5 (to bottom, meaning open to bottom)
ROI 4: A semicircle with center at (1,1), and with radius 3 (opened upside)


I could not be able to attach the figures.

import matplotlib.pyplot as plt

def create_circle():
	circle= plt.Circle((0,0), radius= 20)
	return circle

def show_shape(patch):
	ax=plt.gca()
	ax.add_patch(patch)
	plt.axis('scaled')
	plt.show()

	
if __name__== '__main__':
	c= create_circle()
	show_shape(c)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create mask for different types of images using opencv Prince_Bhatia 2 8,728 Jul-29-2023, 04:40 AM
Last Post: Pedroski55
  Plotting climate data with NetCdf files for a specific region with coordinates fyec 3 5,336 Jun-27-2018, 12:34 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020