repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BerkeleyAutomation/perception | perception/weight_sensor.py | WeightSensor._raw_weights | def _raw_weights(self):
"""Create a numpy array containing the raw sensor weights.
"""
if self._debug:
return np.array([[],[],[],[]])
if not self._running:
raise ValueError('Weight sensor is not running!')
if len(self._weight_buffers) == 0:
ti... | python | def _raw_weights(self):
"""Create a numpy array containing the raw sensor weights.
"""
if self._debug:
return np.array([[],[],[],[]])
if not self._running:
raise ValueError('Weight sensor is not running!')
if len(self._weight_buffers) == 0:
ti... | [
"def",
"_raw_weights",
"(",
"self",
")",
":",
"if",
"self",
".",
"_debug",
":",
"return",
"np",
".",
"array",
"(",
"[",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"]",
")",
"if",
"not",
"self",
".",
"_running",
":",
"raise",
"Valu... | Create a numpy array containing the raw sensor weights. | [
"Create",
"a",
"numpy",
"array",
"containing",
"the",
"raw",
"sensor",
"weights",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/weight_sensor.py#L92-L105 | train | Create a numpy array containing the raw sensor weights. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/weight_sensor.py | WeightSensor._weights_callback | def _weights_callback(self, msg):
"""Callback for recording weights from sensor.
"""
# Read weights
weights = np.array(msg.data)
# If needed, initialize indiv_weight_buffers
if len(self._weight_buffers) == 0:
self._weight_buffers = [[] for i in range(len(weig... | python | def _weights_callback(self, msg):
"""Callback for recording weights from sensor.
"""
# Read weights
weights = np.array(msg.data)
# If needed, initialize indiv_weight_buffers
if len(self._weight_buffers) == 0:
self._weight_buffers = [[] for i in range(len(weig... | [
"def",
"_weights_callback",
"(",
"self",
",",
"msg",
")",
":",
"# Read weights",
"weights",
"=",
"np",
".",
"array",
"(",
"msg",
".",
"data",
")",
"# If needed, initialize indiv_weight_buffers",
"if",
"len",
"(",
"self",
".",
"_weight_buffers",
")",
"==",
"0",... | Callback for recording weights from sensor. | [
"Callback",
"for",
"recording",
"weights",
"from",
"sensor",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/weight_sensor.py#L107-L121 | train | Callback for recording weights from sensor. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/camera_intrinsics.py | CameraIntrinsics.vec | def vec(self):
""":obj:`numpy.ndarray` : Vector representation for this camera.
"""
return np.r_[self.fx, self.fy, self.cx, self.cy, self.skew, self.height, self.width] | python | def vec(self):
""":obj:`numpy.ndarray` : Vector representation for this camera.
"""
return np.r_[self.fx, self.fy, self.cx, self.cy, self.skew, self.height, self.width] | [
"def",
"vec",
"(",
"self",
")",
":",
"return",
"np",
".",
"r_",
"[",
"self",
".",
"fx",
",",
"self",
".",
"fy",
",",
"self",
".",
"cx",
",",
"self",
".",
"cy",
",",
"self",
".",
"skew",
",",
"self",
".",
"height",
",",
"self",
".",
"width",
... | :obj:`numpy.ndarray` : Vector representation for this camera. | [
":",
"obj",
":",
"numpy",
".",
"ndarray",
":",
"Vector",
"representation",
"for",
"this",
"camera",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_intrinsics.py#L136-L139 | train | Vector representation of this camera. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/camera_intrinsics.py | CameraIntrinsics.rosmsg | def rosmsg(self):
""":obj:`sensor_msgs.CamerInfo` : Returns ROS CamerInfo msg
"""
from sensor_msgs.msg import CameraInfo, RegionOfInterest
from std_msgs.msg import Header
msg_header = Header()
msg_header.frame_id = self._frame
msg_roi = RegionOfInterest()
... | python | def rosmsg(self):
""":obj:`sensor_msgs.CamerInfo` : Returns ROS CamerInfo msg
"""
from sensor_msgs.msg import CameraInfo, RegionOfInterest
from std_msgs.msg import Header
msg_header = Header()
msg_header.frame_id = self._frame
msg_roi = RegionOfInterest()
... | [
"def",
"rosmsg",
"(",
"self",
")",
":",
"from",
"sensor_msgs",
".",
"msg",
"import",
"CameraInfo",
",",
"RegionOfInterest",
"from",
"std_msgs",
".",
"msg",
"import",
"Header",
"msg_header",
"=",
"Header",
"(",
")",
"msg_header",
".",
"frame_id",
"=",
"self",... | :obj:`sensor_msgs.CamerInfo` : Returns ROS CamerInfo msg | [
":",
"obj",
":",
"sensor_msgs",
".",
"CamerInfo",
":",
"Returns",
"ROS",
"CamerInfo",
"msg"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_intrinsics.py#L142-L171 | train | Returns the ROS CamerInfo object for the current message. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/camera_intrinsics.py | CameraIntrinsics.crop | def crop(self, height, width, crop_ci, crop_cj):
""" Convert to new camera intrinsics for crop of image from original camera.
Parameters
----------
height : int
height of crop window
width : int
width of crop window
crop_ci : int
row o... | python | def crop(self, height, width, crop_ci, crop_cj):
""" Convert to new camera intrinsics for crop of image from original camera.
Parameters
----------
height : int
height of crop window
width : int
width of crop window
crop_ci : int
row o... | [
"def",
"crop",
"(",
"self",
",",
"height",
",",
"width",
",",
"crop_ci",
",",
"crop_cj",
")",
":",
"cx",
"=",
"self",
".",
"cx",
"+",
"float",
"(",
"width",
"-",
"1",
")",
"/",
"2",
"-",
"crop_cj",
"cy",
"=",
"self",
".",
"cy",
"+",
"float",
... | Convert to new camera intrinsics for crop of image from original camera.
Parameters
----------
height : int
height of crop window
width : int
width of crop window
crop_ci : int
row of crop window center
crop_cj : int
col of... | [
"Convert",
"to",
"new",
"camera",
"intrinsics",
"for",
"crop",
"of",
"image",
"from",
"original",
"camera",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_intrinsics.py#L184-L212 | train | Convert to new camera intrinsics for crop of image from original camera. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/camera_intrinsics.py | CameraIntrinsics.resize | def resize(self, scale):
""" Convert to new camera intrinsics with parameters for resized image.
Parameters
----------
scale : float
the amount to rescale the intrinsics
Returns
-------
:obj:`CameraIntrinsics`
camera intri... | python | def resize(self, scale):
""" Convert to new camera intrinsics with parameters for resized image.
Parameters
----------
scale : float
the amount to rescale the intrinsics
Returns
-------
:obj:`CameraIntrinsics`
camera intri... | [
"def",
"resize",
"(",
"self",
",",
"scale",
")",
":",
"center_x",
"=",
"float",
"(",
"self",
".",
"width",
"-",
"1",
")",
"/",
"2",
"center_y",
"=",
"float",
"(",
"self",
".",
"height",
"-",
"1",
")",
"/",
"2",
"orig_cx_diff",
"=",
"self",
".",
... | Convert to new camera intrinsics with parameters for resized image.
Parameters
----------
scale : float
the amount to rescale the intrinsics
Returns
-------
:obj:`CameraIntrinsics`
camera intrinsics for resized image | [
"Convert",
"to",
"new",
"camera",
"intrinsics",
"with",
"parameters",
"for",
"resized",
"image",
".",
"Parameters",
"----------",
"scale",
":",
"float",
"the",
"amount",
"to",
"rescale",
"the",
"intrinsics",
"Returns",
"-------",
":",
"obj",
":",
"CameraIntrinsi... | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_intrinsics.py#L214-L243 | train | Convert to new camera intrinsics with parameters for resized image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/camera_intrinsics.py | CameraIntrinsics.project | def project(self, point_cloud, round_px=True):
"""Projects a point cloud onto the camera image plane.
Parameters
----------
point_cloud : :obj:`autolab_core.PointCloud` or :obj:`autolab_core.Point`
A PointCloud or Point to project onto the camera image plane.
round_... | python | def project(self, point_cloud, round_px=True):
"""Projects a point cloud onto the camera image plane.
Parameters
----------
point_cloud : :obj:`autolab_core.PointCloud` or :obj:`autolab_core.Point`
A PointCloud or Point to project onto the camera image plane.
round_... | [
"def",
"project",
"(",
"self",
",",
"point_cloud",
",",
"round_px",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"point_cloud",
",",
"PointCloud",
")",
"and",
"not",
"(",
"isinstance",
"(",
"point_cloud",
",",
"Point",
")",
"and",
"point_cloud",
... | Projects a point cloud onto the camera image plane.
Parameters
----------
point_cloud : :obj:`autolab_core.PointCloud` or :obj:`autolab_core.Point`
A PointCloud or Point to project onto the camera image plane.
round_px : bool
If True, projections are rounded to ... | [
"Projects",
"a",
"point",
"cloud",
"onto",
"the",
"camera",
"image",
"plane",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_intrinsics.py#L245-L284 | train | Projects a point cloud onto the camera image plane. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/camera_intrinsics.py | CameraIntrinsics.deproject_to_image | def deproject_to_image(self, depth_image):
"""Deprojects a DepthImage into a PointCloudImage.
Parameters
----------
depth_image : :obj:`DepthImage`
The 2D depth image to projet into a point cloud.
Returns
-------
:obj:`PointCloudImage`
A ... | python | def deproject_to_image(self, depth_image):
"""Deprojects a DepthImage into a PointCloudImage.
Parameters
----------
depth_image : :obj:`DepthImage`
The 2D depth image to projet into a point cloud.
Returns
-------
:obj:`PointCloudImage`
A ... | [
"def",
"deproject_to_image",
"(",
"self",
",",
"depth_image",
")",
":",
"point_cloud",
"=",
"self",
".",
"deproject",
"(",
"depth_image",
")",
"point_cloud_im_data",
"=",
"point_cloud",
".",
"data",
".",
"T",
".",
"reshape",
"(",
"depth_image",
".",
"height",
... | Deprojects a DepthImage into a PointCloudImage.
Parameters
----------
depth_image : :obj:`DepthImage`
The 2D depth image to projet into a point cloud.
Returns
-------
:obj:`PointCloudImage`
A point cloud image created from the depth image.
... | [
"Deprojects",
"a",
"DepthImage",
"into",
"a",
"PointCloudImage",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_intrinsics.py#L372-L394 | train | Deprojects a DepthImage into a PointCloudImage. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/camera_intrinsics.py | CameraIntrinsics.load | def load(filename):
"""Load a CameraIntrinsics object from a file.
Parameters
----------
filename : :obj:`str`
The .intr file to load the object from.
Returns
-------
:obj:`CameraIntrinsics`
The CameraIntrinsics object loaded from the fil... | python | def load(filename):
"""Load a CameraIntrinsics object from a file.
Parameters
----------
filename : :obj:`str`
The .intr file to load the object from.
Returns
-------
:obj:`CameraIntrinsics`
The CameraIntrinsics object loaded from the fil... | [
"def",
"load",
"(",
"filename",
")",
":",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"file_ext",
".",
"lower",
"(",
")",
"!=",
"INTR_EXTENSION",
":",
"raise",
"ValueError",
"(",
"'Extension %s not sup... | Load a CameraIntrinsics object from a file.
Parameters
----------
filename : :obj:`str`
The .intr file to load the object from.
Returns
-------
:obj:`CameraIntrinsics`
The CameraIntrinsics object loaded from the file.
Raises
----... | [
"Load",
"a",
"CameraIntrinsics",
"object",
"from",
"a",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_intrinsics.py#L450-L482 | train | Loads a CameraIntrinsics object from a file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | tools/finetune_classification_cnn.py | finetune_classification_cnn | def finetune_classification_cnn(config):
""" Main function. """
# read params
dataset = config['dataset']
x_names = config['x_names']
y_name = config['y_name']
model_dir = config['model_dir']
debug = config['debug']
num_classes = None
if 'num_classes' in config.keys():
num_c... | python | def finetune_classification_cnn(config):
""" Main function. """
# read params
dataset = config['dataset']
x_names = config['x_names']
y_name = config['y_name']
model_dir = config['model_dir']
debug = config['debug']
num_classes = None
if 'num_classes' in config.keys():
num_c... | [
"def",
"finetune_classification_cnn",
"(",
"config",
")",
":",
"# read params",
"dataset",
"=",
"config",
"[",
"'dataset'",
"]",
"x_names",
"=",
"config",
"[",
"'x_names'",
"]",
"y_name",
"=",
"config",
"[",
"'y_name'",
"]",
"model_dir",
"=",
"config",
"[",
... | Main function. | [
"Main",
"function",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/tools/finetune_classification_cnn.py#L38-L202 | train | Function that finetune classification CNN. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | load_images | def load_images(cfg):
"""Helper function for loading a set of color images, depth images, and IR
camera intrinsics.
The config dictionary must have these keys:
- prestored_data -- If 1, use the virtual sensor, else use a real sensor.
- prestored_data_dir -- A path to the prestored data dir ... | python | def load_images(cfg):
"""Helper function for loading a set of color images, depth images, and IR
camera intrinsics.
The config dictionary must have these keys:
- prestored_data -- If 1, use the virtual sensor, else use a real sensor.
- prestored_data_dir -- A path to the prestored data dir ... | [
"def",
"load_images",
"(",
"cfg",
")",
":",
"if",
"'prestored_data'",
"in",
"cfg",
".",
"keys",
"(",
")",
"and",
"cfg",
"[",
"'prestored_data'",
"]",
"==",
"1",
":",
"sensor",
"=",
"VirtualKinect2Sensor",
"(",
"path_to_images",
"=",
"cfg",
"[",
"'prestored... | Helper function for loading a set of color images, depth images, and IR
camera intrinsics.
The config dictionary must have these keys:
- prestored_data -- If 1, use the virtual sensor, else use a real sensor.
- prestored_data_dir -- A path to the prestored data dir for a virtual sensor.
... | [
"Helper",
"function",
"for",
"loading",
"a",
"set",
"of",
"color",
"images",
"depth",
"images",
"and",
"IR",
"camera",
"intrinsics",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L760-L802 | train | Loads a set of color images depth images and camera intrinsics from a Kinect sensor. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | Kinect2Sensor.color_intrinsics | def color_intrinsics(self):
""":obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's color camera.
"""
if self._device is None:
raise RuntimeError('Kinect2 device %s not runnning. Cannot return color intrinsics')
camera_params = self._device.getColorCameraParams()
... | python | def color_intrinsics(self):
""":obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's color camera.
"""
if self._device is None:
raise RuntimeError('Kinect2 device %s not runnning. Cannot return color intrinsics')
camera_params = self._device.getColorCameraParams()
... | [
"def",
"color_intrinsics",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'Kinect2 device %s not runnning. Cannot return color intrinsics'",
")",
"camera_params",
"=",
"self",
".",
"_device",
".",
"getColorCamera... | :obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's color camera. | [
":",
"obj",
":",
"CameraIntrinsics",
":",
"The",
"camera",
"intrinsics",
"for",
"the",
"Kinect",
"s",
"color",
"camera",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L123-L130 | train | Return a list of camera intrinsics for the Kinect s color camera. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | Kinect2Sensor.ir_intrinsics | def ir_intrinsics(self):
""":obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's IR camera.
"""
if self._device is None:
raise RuntimeError('Kinect2 device %s not runnning. Cannot return IR intrinsics')
camera_params = self._device.getIrCameraParams()
retu... | python | def ir_intrinsics(self):
""":obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's IR camera.
"""
if self._device is None:
raise RuntimeError('Kinect2 device %s not runnning. Cannot return IR intrinsics')
camera_params = self._device.getIrCameraParams()
retu... | [
"def",
"ir_intrinsics",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'Kinect2 device %s not runnning. Cannot return IR intrinsics'",
")",
"camera_params",
"=",
"self",
".",
"_device",
".",
"getIrCameraParams",
... | :obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's IR camera. | [
":",
"obj",
":",
"CameraIntrinsics",
":",
"The",
"camera",
"intrinsics",
"for",
"the",
"Kinect",
"s",
"IR",
"camera",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L133-L142 | train | Return a list of camera intrinsics for the Kinect s IR camera. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | Kinect2Sensor.start | def start(self):
"""Starts the Kinect v2 sensor stream.
Raises
------
IOError
If the Kinect v2 is not detected.
"""
# open packet pipeline
if self._packet_pipeline_mode == Kinect2PacketPipelineMode.OPENGL:
self._pipeline = lf2.OpenGLPacket... | python | def start(self):
"""Starts the Kinect v2 sensor stream.
Raises
------
IOError
If the Kinect v2 is not detected.
"""
# open packet pipeline
if self._packet_pipeline_mode == Kinect2PacketPipelineMode.OPENGL:
self._pipeline = lf2.OpenGLPacket... | [
"def",
"start",
"(",
"self",
")",
":",
"# open packet pipeline",
"if",
"self",
".",
"_packet_pipeline_mode",
"==",
"Kinect2PacketPipelineMode",
".",
"OPENGL",
":",
"self",
".",
"_pipeline",
"=",
"lf2",
".",
"OpenGLPacketPipeline",
"(",
")",
"elif",
"self",
".",
... | Starts the Kinect v2 sensor stream.
Raises
------
IOError
If the Kinect v2 is not detected. | [
"Starts",
"the",
"Kinect",
"v2",
"sensor",
"stream",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L168-L213 | train | Starts the Kinect v2 sensor stream. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | Kinect2Sensor.stop | def stop(self):
"""Stops the Kinect2 sensor stream.
Returns
-------
bool
True if the stream was stopped, False if the device was already
stopped or was not otherwise available.
"""
# check that everything is running
if not self._running or... | python | def stop(self):
"""Stops the Kinect2 sensor stream.
Returns
-------
bool
True if the stream was stopped, False if the device was already
stopped or was not otherwise available.
"""
# check that everything is running
if not self._running or... | [
"def",
"stop",
"(",
"self",
")",
":",
"# check that everything is running",
"if",
"not",
"self",
".",
"_running",
"or",
"self",
".",
"_device",
"is",
"None",
":",
"logging",
".",
"warning",
"(",
"'Kinect2 device %d not runnning. Aborting stop'",
"%",
"(",
"self",
... | Stops the Kinect2 sensor stream.
Returns
-------
bool
True if the stream was stopped, False if the device was already
stopped or was not otherwise available. | [
"Stops",
"the",
"Kinect2",
"sensor",
"stream",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L215-L234 | train | Stops the Kinect2 sensor stream. Returns True if the device was already stopped False otherwise. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | Kinect2Sensor.frames | def frames(self, skip_registration=False):
"""Retrieve a new frame from the Kinect and convert it to a ColorImage,
a DepthImage, and an IrImage.
Parameters
----------
skip_registration : bool
If True, the registration step is skipped.
Returns
-------... | python | def frames(self, skip_registration=False):
"""Retrieve a new frame from the Kinect and convert it to a ColorImage,
a DepthImage, and an IrImage.
Parameters
----------
skip_registration : bool
If True, the registration step is skipped.
Returns
-------... | [
"def",
"frames",
"(",
"self",
",",
"skip_registration",
"=",
"False",
")",
":",
"color_im",
",",
"depth_im",
",",
"ir_im",
",",
"_",
"=",
"self",
".",
"_frames_and_index_map",
"(",
"skip_registration",
"=",
"skip_registration",
")",
"return",
"color_im",
",",
... | Retrieve a new frame from the Kinect and convert it to a ColorImage,
a DepthImage, and an IrImage.
Parameters
----------
skip_registration : bool
If True, the registration step is skipped.
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`Dept... | [
"Retrieve",
"a",
"new",
"frame",
"from",
"the",
"Kinect",
"and",
"convert",
"it",
"to",
"a",
"ColorImage",
"a",
"DepthImage",
"and",
"an",
"IrImage",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L236-L256 | train | Retrieve a new frame from the Kinect and convert it to a ColorImage DepthImage and IrImage. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | Kinect2Sensor._frames_and_index_map | def _frames_and_index_map(self, skip_registration=False):
"""Retrieve a new frame from the Kinect and return a ColorImage,
DepthImage, IrImage, and a map from depth pixels to color pixel indices.
Parameters
----------
skip_registration : bool
If True, the registratio... | python | def _frames_and_index_map(self, skip_registration=False):
"""Retrieve a new frame from the Kinect and return a ColorImage,
DepthImage, IrImage, and a map from depth pixels to color pixel indices.
Parameters
----------
skip_registration : bool
If True, the registratio... | [
"def",
"_frames_and_index_map",
"(",
"self",
",",
"skip_registration",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_running",
":",
"raise",
"RuntimeError",
"(",
"'Kinect2 device %s not runnning. Cannot read frames'",
"%",
"(",
"self",
".",
"_device_num",
")",... | Retrieve a new frame from the Kinect and return a ColorImage,
DepthImage, IrImage, and a map from depth pixels to color pixel indices.
Parameters
----------
skip_registration : bool
If True, the registration step is skipped.
Returns
-------
:obj:`tup... | [
"Retrieve",
"a",
"new",
"frame",
"from",
"the",
"Kinect",
"and",
"return",
"a",
"ColorImage",
"DepthImage",
"IrImage",
"and",
"a",
"map",
"from",
"depth",
"pixels",
"to",
"color",
"pixel",
"indices",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L279-L339 | train | Retrieve a new frame from the Kinect and return a ColorImage DepthImage IrImage and a map from depth pixels to color pixel indices. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | KinectSensorBridged._process_image_msg | def _process_image_msg(self, msg):
""" Process an image message and return a numpy array with the image data
Returns
-------
:obj:`numpy.ndarray` containing the image in the image message
Raises
------
CvBridgeError
If the bridge is not able to conver... | python | def _process_image_msg(self, msg):
""" Process an image message and return a numpy array with the image data
Returns
-------
:obj:`numpy.ndarray` containing the image in the image message
Raises
------
CvBridgeError
If the bridge is not able to conver... | [
"def",
"_process_image_msg",
"(",
"self",
",",
"msg",
")",
":",
"encoding",
"=",
"msg",
".",
"encoding",
"try",
":",
"image",
"=",
"self",
".",
"_bridge",
".",
"imgmsg_to_cv2",
"(",
"msg",
",",
"encoding",
")",
"except",
"CvBridgeError",
"as",
"e",
":",
... | Process an image message and return a numpy array with the image data
Returns
-------
:obj:`numpy.ndarray` containing the image in the image message
Raises
------
CvBridgeError
If the bridge is not able to convert the image | [
"Process",
"an",
"image",
"message",
"and",
"return",
"a",
"numpy",
"array",
"with",
"the",
"image",
"data",
"Returns",
"-------",
":",
"obj",
":",
"numpy",
".",
"ndarray",
"containing",
"the",
"image",
"in",
"the",
"image",
"message"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L389-L405 | train | Process an image message and return a numpy array with the image data | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | KinectSensorBridged._color_image_callback | def _color_image_callback(self, image_msg):
""" subscribe to image topic and keep it up to date
"""
color_arr = self._process_image_msg(image_msg)
self._cur_color_im = ColorImage(color_arr[:,:,::-1], self._frame) | python | def _color_image_callback(self, image_msg):
""" subscribe to image topic and keep it up to date
"""
color_arr = self._process_image_msg(image_msg)
self._cur_color_im = ColorImage(color_arr[:,:,::-1], self._frame) | [
"def",
"_color_image_callback",
"(",
"self",
",",
"image_msg",
")",
":",
"color_arr",
"=",
"self",
".",
"_process_image_msg",
"(",
"image_msg",
")",
"self",
".",
"_cur_color_im",
"=",
"ColorImage",
"(",
"color_arr",
"[",
":",
",",
":",
",",
":",
":",
"-",
... | subscribe to image topic and keep it up to date | [
"subscribe",
"to",
"image",
"topic",
"and",
"keep",
"it",
"up",
"to",
"date"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L407-L411 | train | Process color image message and store it in self. _cur_color_im | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | KinectSensorBridged._depth_image_callback | def _depth_image_callback(self, image_msg):
""" subscribe to depth image topic and keep it up to date
"""
encoding = image_msg.encoding
try:
depth_arr = self._bridge.imgmsg_to_cv2(image_msg, encoding)
import pdb; pdb.set_trace()
except CvBridgeError as e:... | python | def _depth_image_callback(self, image_msg):
""" subscribe to depth image topic and keep it up to date
"""
encoding = image_msg.encoding
try:
depth_arr = self._bridge.imgmsg_to_cv2(image_msg, encoding)
import pdb; pdb.set_trace()
except CvBridgeError as e:... | [
"def",
"_depth_image_callback",
"(",
"self",
",",
"image_msg",
")",
":",
"encoding",
"=",
"image_msg",
".",
"encoding",
"try",
":",
"depth_arr",
"=",
"self",
".",
"_bridge",
".",
"imgmsg_to_cv2",
"(",
"image_msg",
",",
"encoding",
")",
"import",
"pdb",
"pdb"... | subscribe to depth image topic and keep it up to date | [
"subscribe",
"to",
"depth",
"image",
"topic",
"and",
"keep",
"it",
"up",
"to",
"date"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L413-L424 | train | Callback function for depth image topic | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | KinectSensorBridged.start | def start(self):
""" Start the sensor """
# initialize subscribers
self._image_sub = rospy.Subscriber(self.topic_image_color, sensor_msgs.msg.Image, self._color_image_callback)
self._depth_sub = rospy.Subscriber(self.topic_image_depth, sensor_msgs.msg.Image, self._depth_image_callback)
... | python | def start(self):
""" Start the sensor """
# initialize subscribers
self._image_sub = rospy.Subscriber(self.topic_image_color, sensor_msgs.msg.Image, self._color_image_callback)
self._depth_sub = rospy.Subscriber(self.topic_image_depth, sensor_msgs.msg.Image, self._depth_image_callback)
... | [
"def",
"start",
"(",
"self",
")",
":",
"# initialize subscribers",
"self",
".",
"_image_sub",
"=",
"rospy",
".",
"Subscriber",
"(",
"self",
".",
"topic_image_color",
",",
"sensor_msgs",
".",
"msg",
".",
"Image",
",",
"self",
".",
"_color_image_callback",
")",
... | Start the sensor | [
"Start",
"the",
"sensor"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L449-L470 | train | Start the sensor | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | KinectSensorBridged.stop | def stop(self):
""" Stop the sensor """
# check that everything is running
if not self._running:
logging.warning('Kinect not running. Aborting stop')
return False
# stop subs
self._image_sub.unregister()
self._depth_sub.unregister()
self._... | python | def stop(self):
""" Stop the sensor """
# check that everything is running
if not self._running:
logging.warning('Kinect not running. Aborting stop')
return False
# stop subs
self._image_sub.unregister()
self._depth_sub.unregister()
self._... | [
"def",
"stop",
"(",
"self",
")",
":",
"# check that everything is running",
"if",
"not",
"self",
".",
"_running",
":",
"logging",
".",
"warning",
"(",
"'Kinect not running. Aborting stop'",
")",
"return",
"False",
"# stop subs",
"self",
".",
"_image_sub",
".",
"un... | Stop the sensor | [
"Stop",
"the",
"sensor"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L472-L485 | train | Stop the Kinect sensor | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | KinectSensorBridged.frames | def frames(self):
"""Retrieve a new frame from the Ensenso and convert it to a ColorImage,
a DepthImage, IrImage is always none for this type
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray`
The ColorImage, De... | python | def frames(self):
"""Retrieve a new frame from the Ensenso and convert it to a ColorImage,
a DepthImage, IrImage is always none for this type
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray`
The ColorImage, De... | [
"def",
"frames",
"(",
"self",
")",
":",
"# wait for a new image",
"while",
"self",
".",
"_cur_depth_im",
"is",
"None",
"or",
"self",
".",
"_cur_color_im",
"is",
"None",
":",
"time",
".",
"sleep",
"(",
"0.01",
")",
"# read next image",
"depth_im",
"=",
"self"... | Retrieve a new frame from the Ensenso and convert it to a ColorImage,
a DepthImage, IrImage is always none for this type
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray`
The ColorImage, DepthImage, and IrImage of the ... | [
"Retrieve",
"a",
"new",
"frame",
"from",
"the",
"Ensenso",
"and",
"convert",
"it",
"to",
"a",
"ColorImage",
"a",
"DepthImage",
"IrImage",
"is",
"always",
"none",
"for",
"this",
"type"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L487-L513 | train | Retrieve a new frame from the Ensenso and convert it to a ColorImage DepthImage IrImage | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | VirtualKinect2Sensor.frames | def frames(self):
"""Retrieve the next frame from the image directory and convert it to a ColorImage,
a DepthImage, and an IrImage.
Parameters
----------
skip_registration : bool
If True, the registration step is skipped.
Returns
-------
:obj... | python | def frames(self):
"""Retrieve the next frame from the image directory and convert it to a ColorImage,
a DepthImage, and an IrImage.
Parameters
----------
skip_registration : bool
If True, the registration step is skipped.
Returns
-------
:obj... | [
"def",
"frames",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_running",
":",
"raise",
"RuntimeError",
"(",
"'VirtualKinect2 device pointing to %s not runnning. Cannot read frames'",
"%",
"(",
"self",
".",
"_path_to_images",
")",
")",
"if",
"self",
".",
"_im_... | Retrieve the next frame from the image directory and convert it to a ColorImage,
a DepthImage, and an IrImage.
Parameters
----------
skip_registration : bool
If True, the registration step is skipped.
Returns
-------
:obj:`tuple` of :obj:`ColorImage`... | [
"Retrieve",
"the",
"next",
"frame",
"from",
"the",
"image",
"directory",
"and",
"convert",
"it",
"to",
"a",
"ColorImage",
"a",
"DepthImage",
"and",
"an",
"IrImage",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L673-L709 | train | Retrieve the next frame from the image directory and convert it to a ColorImage DepthImage and IrImage. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/kinect2_sensor.py | Kinect2SensorFactory.sensor | def sensor(sensor_type, cfg):
""" Creates a Kinect2 sensor of the specified type.
Parameters
----------
sensor_type : :obj:`str`
the type of the sensor (real or virtual)
cfg : :obj:`YamlConfig`
dictionary of parameters for sensor initialization
""... | python | def sensor(sensor_type, cfg):
""" Creates a Kinect2 sensor of the specified type.
Parameters
----------
sensor_type : :obj:`str`
the type of the sensor (real or virtual)
cfg : :obj:`YamlConfig`
dictionary of parameters for sensor initialization
""... | [
"def",
"sensor",
"(",
"sensor_type",
",",
"cfg",
")",
":",
"sensor_type",
"=",
"sensor_type",
".",
"lower",
"(",
")",
"if",
"sensor_type",
"==",
"'real'",
":",
"s",
"=",
"Kinect2Sensor",
"(",
"packet_pipeline_mode",
"=",
"cfg",
"[",
"'pipeline_mode'",
"]",
... | Creates a Kinect2 sensor of the specified type.
Parameters
----------
sensor_type : :obj:`str`
the type of the sensor (real or virtual)
cfg : :obj:`YamlConfig`
dictionary of parameters for sensor initialization | [
"Creates",
"a",
"Kinect2",
"sensor",
"of",
"the",
"specified",
"type",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L736-L758 | train | Creates a Kinect2 sensor of the specified type. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | ros_nodes/weight_publisher.py | WeightPublisher._connect | def _connect(self, id_mask):
"""Connects to all of the load cells serially.
"""
# Get all devices attached as USB serial
all_devices = glob.glob('/dev/ttyUSB*')
# Identify which of the devices are LoadStar Serial Sensors
sensors = []
for device in all_devices:
... | python | def _connect(self, id_mask):
"""Connects to all of the load cells serially.
"""
# Get all devices attached as USB serial
all_devices = glob.glob('/dev/ttyUSB*')
# Identify which of the devices are LoadStar Serial Sensors
sensors = []
for device in all_devices:
... | [
"def",
"_connect",
"(",
"self",
",",
"id_mask",
")",
":",
"# Get all devices attached as USB serial",
"all_devices",
"=",
"glob",
".",
"glob",
"(",
"'/dev/ttyUSB*'",
")",
"# Identify which of the devices are LoadStar Serial Sensors",
"sensors",
"=",
"[",
"]",
"for",
"de... | Connects to all of the load cells serially. | [
"Connects",
"to",
"all",
"of",
"the",
"load",
"cells",
"serially",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/ros_nodes/weight_publisher.py#L69-L100 | train | Connects to all of the load cells serially. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | ros_nodes/weight_publisher.py | WeightPublisher._flush | def _flush(self):
"""Flushes all of the serial ports.
"""
for ser in self._serials:
ser.flush()
ser.flushInput()
ser.flushOutput()
time.sleep(0.02) | python | def _flush(self):
"""Flushes all of the serial ports.
"""
for ser in self._serials:
ser.flush()
ser.flushInput()
ser.flushOutput()
time.sleep(0.02) | [
"def",
"_flush",
"(",
"self",
")",
":",
"for",
"ser",
"in",
"self",
".",
"_serials",
":",
"ser",
".",
"flush",
"(",
")",
"ser",
".",
"flushInput",
"(",
")",
"ser",
".",
"flushOutput",
"(",
")",
"time",
".",
"sleep",
"(",
"0.02",
")"
] | Flushes all of the serial ports. | [
"Flushes",
"all",
"of",
"the",
"serial",
"ports",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/ros_nodes/weight_publisher.py#L103-L110 | train | Flushes all of the serial ports. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | ros_nodes/weight_publisher.py | WeightPublisher._tare | def _tare(self):
"""Zeros out (tare) all of the load cells.
"""
for ser in self._serials:
ser.write('TARE\r')
ser.flush()
ser.flushInput()
ser.flushOutput()
time.sleep(0.02) | python | def _tare(self):
"""Zeros out (tare) all of the load cells.
"""
for ser in self._serials:
ser.write('TARE\r')
ser.flush()
ser.flushInput()
ser.flushOutput()
time.sleep(0.02) | [
"def",
"_tare",
"(",
"self",
")",
":",
"for",
"ser",
"in",
"self",
".",
"_serials",
":",
"ser",
".",
"write",
"(",
"'TARE\\r'",
")",
"ser",
".",
"flush",
"(",
")",
"ser",
".",
"flushInput",
"(",
")",
"ser",
".",
"flushOutput",
"(",
")",
"time",
"... | Zeros out (tare) all of the load cells. | [
"Zeros",
"out",
"(",
"tare",
")",
"all",
"of",
"the",
"load",
"cells",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/ros_nodes/weight_publisher.py#L113-L121 | train | Zeros out all load cells. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | ros_nodes/weight_publisher.py | WeightPublisher._read_weights | def _read_weights(self):
"""Reads weights from each of the load cells.
"""
weights = []
grams_per_pound = 453.592
# Read from each of the sensors
for ser in self._serials:
ser.write('W\r')
ser.flush()
time.sleep(0.02)
for ser in s... | python | def _read_weights(self):
"""Reads weights from each of the load cells.
"""
weights = []
grams_per_pound = 453.592
# Read from each of the sensors
for ser in self._serials:
ser.write('W\r')
ser.flush()
time.sleep(0.02)
for ser in s... | [
"def",
"_read_weights",
"(",
"self",
")",
":",
"weights",
"=",
"[",
"]",
"grams_per_pound",
"=",
"453.592",
"# Read from each of the sensors",
"for",
"ser",
"in",
"self",
".",
"_serials",
":",
"ser",
".",
"write",
"(",
"'W\\r'",
")",
"ser",
".",
"flush",
"... | Reads weights from each of the load cells. | [
"Reads",
"weights",
"from",
"each",
"of",
"the",
"load",
"cells",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/ros_nodes/weight_publisher.py#L124-L150 | train | Reads the weights from each of the load cells. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/video_recorder.py | _Camera.run | def run(self):
""" Continually write images to the filename specified by a command queue. """
if not self.camera.is_running:
self.camera.start()
while True:
if not self.cmd_q.empty():
cmd = self.cmd_q.get()
if cmd[0] == 'stop':
... | python | def run(self):
""" Continually write images to the filename specified by a command queue. """
if not self.camera.is_running:
self.camera.start()
while True:
if not self.cmd_q.empty():
cmd = self.cmd_q.get()
if cmd[0] == 'stop':
... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"camera",
".",
"is_running",
":",
"self",
".",
"camera",
".",
"start",
"(",
")",
"while",
"True",
":",
"if",
"not",
"self",
".",
"cmd_q",
".",
"empty",
"(",
")",
":",
"cmd",
"=",
"s... | Continually write images to the filename specified by a command queue. | [
"Continually",
"write",
"images",
"to",
"the",
"filename",
"specified",
"by",
"a",
"command",
"queue",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/video_recorder.py#L48-L75 | train | Continually write images to the filename specified by a command queue. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/video_recorder.py | VideoRecorder.start | def start(self):
""" Starts the camera recording process. """
self._started = True
self._camera = _Camera(self._actual_camera, self._cmd_q, self._res, self._codec, self._fps, self._rate)
self._camera.start() | python | def start(self):
""" Starts the camera recording process. """
self._started = True
self._camera = _Camera(self._actual_camera, self._cmd_q, self._res, self._codec, self._fps, self._rate)
self._camera.start() | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"_started",
"=",
"True",
"self",
".",
"_camera",
"=",
"_Camera",
"(",
"self",
".",
"_actual_camera",
",",
"self",
".",
"_cmd_q",
",",
"self",
".",
"_res",
",",
"self",
".",
"_codec",
",",
"self",
... | Starts the camera recording process. | [
"Starts",
"the",
"camera",
"recording",
"process",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/video_recorder.py#L114-L118 | train | Starts the camera recording process. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/video_recorder.py | VideoRecorder.start_recording | def start_recording(self, output_file):
""" Starts recording to a given output video file.
Parameters
----------
output_file : :obj:`str`
filename to write video to
"""
if not self._started:
raise Exception("Must start the video recorder first by ... | python | def start_recording(self, output_file):
""" Starts recording to a given output video file.
Parameters
----------
output_file : :obj:`str`
filename to write video to
"""
if not self._started:
raise Exception("Must start the video recorder first by ... | [
"def",
"start_recording",
"(",
"self",
",",
"output_file",
")",
":",
"if",
"not",
"self",
".",
"_started",
":",
"raise",
"Exception",
"(",
"\"Must start the video recorder first by calling .start()!\"",
")",
"if",
"self",
".",
"_recording",
":",
"raise",
"Exception"... | Starts recording to a given output video file.
Parameters
----------
output_file : :obj:`str`
filename to write video to | [
"Starts",
"recording",
"to",
"a",
"given",
"output",
"video",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/video_recorder.py#L120-L133 | train | Starts recording to a given output video file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/video_recorder.py | VideoRecorder.stop_recording | def stop_recording(self):
""" Stops writing video to file. """
if not self._recording:
raise Exception("Cannot stop a video recording when it's not recording!")
self._cmd_q.put(('stop',))
self._recording = False | python | def stop_recording(self):
""" Stops writing video to file. """
if not self._recording:
raise Exception("Cannot stop a video recording when it's not recording!")
self._cmd_q.put(('stop',))
self._recording = False | [
"def",
"stop_recording",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_recording",
":",
"raise",
"Exception",
"(",
"\"Cannot stop a video recording when it's not recording!\"",
")",
"self",
".",
"_cmd_q",
".",
"put",
"(",
"(",
"'stop'",
",",
")",
")",
"se... | Stops writing video to file. | [
"Stops",
"writing",
"video",
"to",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/video_recorder.py#L135-L140 | train | Stops writing video to file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/video_recorder.py | VideoRecorder.stop | def stop(self):
""" Stop the camera process. """
if not self._started:
raise Exception("Cannot stop a video recorder before starting it!")
self._started = False
if self._actual_camera.is_running:
self._actual_camera.stop()
if self._camera is not None:
... | python | def stop(self):
""" Stop the camera process. """
if not self._started:
raise Exception("Cannot stop a video recorder before starting it!")
self._started = False
if self._actual_camera.is_running:
self._actual_camera.stop()
if self._camera is not None:
... | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_started",
":",
"raise",
"Exception",
"(",
"\"Cannot stop a video recorder before starting it!\"",
")",
"self",
".",
"_started",
"=",
"False",
"if",
"self",
".",
"_actual_camera",
".",
"is_running"... | Stop the camera process. | [
"Stop",
"the",
"camera",
"process",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/video_recorder.py#L142-L153 | train | Stop the camera process. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image._preprocess_data | def _preprocess_data(self, data):
"""Converts a data array to the preferred 3D structure.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to process.
Returns
-------
:obj:`numpy.ndarray`
The data re-formatted (if needed) as a 3... | python | def _preprocess_data(self, data):
"""Converts a data array to the preferred 3D structure.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to process.
Returns
-------
:obj:`numpy.ndarray`
The data re-formatted (if needed) as a 3... | [
"def",
"_preprocess_data",
"(",
"self",
",",
"data",
")",
":",
"original_type",
"=",
"data",
".",
"dtype",
"if",
"len",
"(",
"data",
".",
"shape",
")",
"==",
"1",
":",
"data",
"=",
"data",
"[",
":",
",",
"np",
".",
"newaxis",
",",
"np",
".",
"new... | Converts a data array to the preferred 3D structure.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to process.
Returns
-------
:obj:`numpy.ndarray`
The data re-formatted (if needed) as a 3D matrix
Raises
------
... | [
"Converts",
"a",
"data",
"array",
"to",
"the",
"preferred",
"3D",
"structure",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L77-L103 | train | Converts a data array to the preferred 3D structure. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.rosmsg | def rosmsg(self):
""":obj:`sensor_msgs.Image` : ROS Image
"""
from cv_bridge import CvBridge, CvBridgeError
cv_bridge = CvBridge()
try:
return cv_bridge.cv2_to_imgmsg(self._data, encoding=self._encoding)
except CvBridgeError as cv_bridge_exception:
... | python | def rosmsg(self):
""":obj:`sensor_msgs.Image` : ROS Image
"""
from cv_bridge import CvBridge, CvBridgeError
cv_bridge = CvBridge()
try:
return cv_bridge.cv2_to_imgmsg(self._data, encoding=self._encoding)
except CvBridgeError as cv_bridge_exception:
... | [
"def",
"rosmsg",
"(",
"self",
")",
":",
"from",
"cv_bridge",
"import",
"CvBridge",
",",
"CvBridgeError",
"cv_bridge",
"=",
"CvBridge",
"(",
")",
"try",
":",
"return",
"cv_bridge",
".",
"cv2_to_imgmsg",
"(",
"self",
".",
"_data",
",",
"encoding",
"=",
"self... | :obj:`sensor_msgs.Image` : ROS Image | [
":",
"obj",
":",
"sensor_msgs",
".",
"Image",
":",
"ROS",
"Image"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L186-L194 | train | Return the ROS Image object. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.can_convert | def can_convert(x):
""" Returns True if x can be converted to an image, False otherwise. """
if len(x.shape) < 2 or len(x.shape) > 3:
return False
dtype = x.dtype
height = x.shape[0]
width = x.shape[1]
channels = 1
if len(x.shape) == 3:
cha... | python | def can_convert(x):
""" Returns True if x can be converted to an image, False otherwise. """
if len(x.shape) < 2 or len(x.shape) > 3:
return False
dtype = x.dtype
height = x.shape[0]
width = x.shape[1]
channels = 1
if len(x.shape) == 3:
cha... | [
"def",
"can_convert",
"(",
"x",
")",
":",
"if",
"len",
"(",
"x",
".",
"shape",
")",
"<",
"2",
"or",
"len",
"(",
"x",
".",
"shape",
")",
">",
"3",
":",
"return",
"False",
"dtype",
"=",
"x",
".",
"dtype",
"height",
"=",
"x",
".",
"shape",
"[",
... | Returns True if x can be converted to an image, False otherwise. | [
"Returns",
"True",
"if",
"x",
"can",
"be",
"converted",
"to",
"an",
"image",
"False",
"otherwise",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L237-L249 | train | Returns True if x can be converted to an image False otherwise. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.from_array | def from_array(x, frame='unspecified'):
""" Converts an array of data to an Image based on the values in the array and the data format. """
if not Image.can_convert(x):
raise ValueError('Cannot convert array to an Image!')
dtype = x.dtype
height = x.shape[0]
width =... | python | def from_array(x, frame='unspecified'):
""" Converts an array of data to an Image based on the values in the array and the data format. """
if not Image.can_convert(x):
raise ValueError('Cannot convert array to an Image!')
dtype = x.dtype
height = x.shape[0]
width =... | [
"def",
"from_array",
"(",
"x",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"if",
"not",
"Image",
".",
"can_convert",
"(",
"x",
")",
":",
"raise",
"ValueError",
"(",
"'Cannot convert array to an Image!'",
")",
"dtype",
"=",
"x",
".",
"dtype",
"height",
"=... | Converts an array of data to an Image based on the values in the array and the data format. | [
"Converts",
"an",
"array",
"of",
"data",
"to",
"an",
"Image",
"based",
"on",
"the",
"values",
"in",
"the",
"array",
"and",
"the",
"data",
"format",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L252-L291 | train | Converts an array of data to an Image based on the values in the array and the data format. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.transform | def transform(self, translation, theta, method='opencv'):
"""Create a new image by translating and rotating the current image.
Parameters
----------
translation : :obj:`numpy.ndarray` of float
The XY translation vector.
theta : float
Rotation angle in rad... | python | def transform(self, translation, theta, method='opencv'):
"""Create a new image by translating and rotating the current image.
Parameters
----------
translation : :obj:`numpy.ndarray` of float
The XY translation vector.
theta : float
Rotation angle in rad... | [
"def",
"transform",
"(",
"self",
",",
"translation",
",",
"theta",
",",
"method",
"=",
"'opencv'",
")",
":",
"theta",
"=",
"np",
".",
"rad2deg",
"(",
"theta",
")",
"trans_map",
"=",
"np",
".",
"float32",
"(",
"[",
"[",
"1",
",",
"0",
",",
"translat... | Create a new image by translating and rotating the current image.
Parameters
----------
translation : :obj:`numpy.ndarray` of float
The XY translation vector.
theta : float
Rotation angle in radians, with positive meaning counter-clockwise.
method : :obj:... | [
"Create",
"a",
"new",
"image",
"by",
"translating",
"and",
"rotating",
"the",
"current",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L293-L330 | train | Creates a new image by translating and rotating the current image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.align | def align(self, scale, center, angle, height, width):
""" Create a thumbnail from the original image that
is scaled by the given factor, centered on the center pixel, oriented along the grasp angle, and cropped to the desired height and width.
Parameters
----------
scale : float... | python | def align(self, scale, center, angle, height, width):
""" Create a thumbnail from the original image that
is scaled by the given factor, centered on the center pixel, oriented along the grasp angle, and cropped to the desired height and width.
Parameters
----------
scale : float... | [
"def",
"align",
"(",
"self",
",",
"scale",
",",
"center",
",",
"angle",
",",
"height",
",",
"width",
")",
":",
"# rescale",
"scaled_im",
"=",
"self",
".",
"resize",
"(",
"scale",
")",
"# transform",
"cx",
"=",
"scaled_im",
".",
"center",
"[",
"1",
"]... | Create a thumbnail from the original image that
is scaled by the given factor, centered on the center pixel, oriented along the grasp angle, and cropped to the desired height and width.
Parameters
----------
scale : float
scale factor to apply
center : 2D array
... | [
"Create",
"a",
"thumbnail",
"from",
"the",
"original",
"image",
"that",
"is",
"scaled",
"by",
"the",
"given",
"factor",
"centered",
"on",
"the",
"center",
"pixel",
"oriented",
"along",
"the",
"grasp",
"angle",
"and",
"cropped",
"to",
"the",
"desired",
"heigh... | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L332-L362 | train | Create a new image that is aligned to the given height and width. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.gradients | def gradients(self):
"""Return the gradient as a pair of numpy arrays.
Returns
-------
:obj:`tuple` of :obj:`numpy.ndarray` of float
The gradients of the image along each dimension.
"""
g = np.gradient(self.data.astype(np.float32))
return g | python | def gradients(self):
"""Return the gradient as a pair of numpy arrays.
Returns
-------
:obj:`tuple` of :obj:`numpy.ndarray` of float
The gradients of the image along each dimension.
"""
g = np.gradient(self.data.astype(np.float32))
return g | [
"def",
"gradients",
"(",
"self",
")",
":",
"g",
"=",
"np",
".",
"gradient",
"(",
"self",
".",
"data",
".",
"astype",
"(",
"np",
".",
"float32",
")",
")",
"return",
"g"
] | Return the gradient as a pair of numpy arrays.
Returns
-------
:obj:`tuple` of :obj:`numpy.ndarray` of float
The gradients of the image along each dimension. | [
"Return",
"the",
"gradient",
"as",
"a",
"pair",
"of",
"numpy",
"arrays",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L364-L373 | train | Return the gradient as a pair of numpy arrays. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.linear_to_ij | def linear_to_ij(self, linear_inds):
"""Converts linear indices to row and column coordinates.
Parameters
----------
linear_inds : :obj:`numpy.ndarray` of int
A list of linear coordinates.
Returns
-------
:obj:`numpy.ndarray` of int
A 2D ... | python | def linear_to_ij(self, linear_inds):
"""Converts linear indices to row and column coordinates.
Parameters
----------
linear_inds : :obj:`numpy.ndarray` of int
A list of linear coordinates.
Returns
-------
:obj:`numpy.ndarray` of int
A 2D ... | [
"def",
"linear_to_ij",
"(",
"self",
",",
"linear_inds",
")",
":",
"return",
"np",
".",
"c_",
"[",
"linear_inds",
"/",
"self",
".",
"width",
",",
"linear_inds",
"%",
"self",
".",
"width",
"]"
] | Converts linear indices to row and column coordinates.
Parameters
----------
linear_inds : :obj:`numpy.ndarray` of int
A list of linear coordinates.
Returns
-------
:obj:`numpy.ndarray` of int
A 2D ndarray whose first entry is the list of row ind... | [
"Converts",
"linear",
"indices",
"to",
"row",
"and",
"column",
"coordinates",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L393-L407 | train | Converts linear indices to row and column coordinates. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.is_same_shape | def is_same_shape(self, other_im, check_channels=False):
""" Checks if two images have the same height and width (and optionally channels).
Parameters
----------
other_im : :obj:`Image`
image to compare
check_channels : bool
whether or not to check equali... | python | def is_same_shape(self, other_im, check_channels=False):
""" Checks if two images have the same height and width (and optionally channels).
Parameters
----------
other_im : :obj:`Image`
image to compare
check_channels : bool
whether or not to check equali... | [
"def",
"is_same_shape",
"(",
"self",
",",
"other_im",
",",
"check_channels",
"=",
"False",
")",
":",
"if",
"self",
".",
"height",
"==",
"other_im",
".",
"height",
"and",
"self",
".",
"width",
"==",
"other_im",
".",
"width",
":",
"if",
"check_channels",
"... | Checks if two images have the same height and width (and optionally channels).
Parameters
----------
other_im : :obj:`Image`
image to compare
check_channels : bool
whether or not to check equality of the channels
Returns
-------
bool
... | [
"Checks",
"if",
"two",
"images",
"have",
"the",
"same",
"height",
"and",
"width",
"(",
"and",
"optionally",
"channels",
")",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L409-L428 | train | Checks if two images have the same height and width and optionally channels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.mask_by_ind | def mask_by_ind(self, inds):
"""Create a new image by zeroing out data at locations not in the
given indices.
Parameters
----------
inds : :obj:`numpy.ndarray` of int
A 2D ndarray whose first entry is the list of row indices
and whose second entry is the ... | python | def mask_by_ind(self, inds):
"""Create a new image by zeroing out data at locations not in the
given indices.
Parameters
----------
inds : :obj:`numpy.ndarray` of int
A 2D ndarray whose first entry is the list of row indices
and whose second entry is the ... | [
"def",
"mask_by_ind",
"(",
"self",
",",
"inds",
")",
":",
"new_data",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"shape",
")",
"for",
"ind",
"in",
"inds",
":",
"new_data",
"[",
"ind",
"[",
"0",
"]",
",",
"ind",
"[",
"1",
"]",
"]",
"=",
"self",
... | Create a new image by zeroing out data at locations not in the
given indices.
Parameters
----------
inds : :obj:`numpy.ndarray` of int
A 2D ndarray whose first entry is the list of row indices
and whose second entry is the list of column indices.
The ... | [
"Create",
"a",
"new",
"image",
"by",
"zeroing",
"out",
"data",
"at",
"locations",
"not",
"in",
"the",
"given",
"indices",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L430-L450 | train | Create a new image by zeroing out data at locations not in the
given indices. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.mask_by_linear_ind | def mask_by_linear_ind(self, linear_inds):
"""Create a new image by zeroing out data at locations not in the
given indices.
Parameters
----------
linear_inds : :obj:`numpy.ndarray` of int
A list of linear coordinates.
Returns
-------
:obj:`Im... | python | def mask_by_linear_ind(self, linear_inds):
"""Create a new image by zeroing out data at locations not in the
given indices.
Parameters
----------
linear_inds : :obj:`numpy.ndarray` of int
A list of linear coordinates.
Returns
-------
:obj:`Im... | [
"def",
"mask_by_linear_ind",
"(",
"self",
",",
"linear_inds",
")",
":",
"inds",
"=",
"self",
".",
"linear_to_ij",
"(",
"linear_inds",
")",
"return",
"self",
".",
"mask_by_ind",
"(",
"inds",
")"
] | Create a new image by zeroing out data at locations not in the
given indices.
Parameters
----------
linear_inds : :obj:`numpy.ndarray` of int
A list of linear coordinates.
Returns
-------
:obj:`Image`
A new Image of the same type, with da... | [
"Create",
"a",
"new",
"image",
"by",
"zeroing",
"out",
"data",
"at",
"locations",
"not",
"in",
"the",
"given",
"indices",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L452-L468 | train | Create a new image by zeroing out data at locations not in the
given indices. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.median_images | def median_images(images):
"""Create a median Image from a list of Images.
Parameters
----------
:obj:`list` of :obj:`Image`
A list of Image objects.
Returns
-------
:obj:`Image`
A new Image of the same type whose data is the median of al... | python | def median_images(images):
"""Create a median Image from a list of Images.
Parameters
----------
:obj:`list` of :obj:`Image`
A list of Image objects.
Returns
-------
:obj:`Image`
A new Image of the same type whose data is the median of al... | [
"def",
"median_images",
"(",
"images",
")",
":",
"images_data",
"=",
"np",
".",
"array",
"(",
"[",
"image",
".",
"data",
"for",
"image",
"in",
"images",
"]",
")",
"median_image_data",
"=",
"np",
".",
"median",
"(",
"images_data",
",",
"axis",
"=",
"0",... | Create a median Image from a list of Images.
Parameters
----------
:obj:`list` of :obj:`Image`
A list of Image objects.
Returns
-------
:obj:`Image`
A new Image of the same type whose data is the median of all of
the images' data. | [
"Create",
"a",
"median",
"Image",
"from",
"a",
"list",
"of",
"Images",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L493-L514 | train | Create a median Image from a list of Images. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.min_images | def min_images(images):
"""Create a min Image from a list of Images.
Parameters
----------
:obj:`list` of :obj:`Image`
A list of Image objects.
Returns
-------
:obj:`Image`
A new Image of the same type whose data is the min of all of
... | python | def min_images(images):
"""Create a min Image from a list of Images.
Parameters
----------
:obj:`list` of :obj:`Image`
A list of Image objects.
Returns
-------
:obj:`Image`
A new Image of the same type whose data is the min of all of
... | [
"def",
"min_images",
"(",
"images",
")",
":",
"images_data",
"=",
"np",
".",
"array",
"(",
"[",
"image",
".",
"data",
"for",
"image",
"in",
"images",
"]",
")",
"images_data",
"[",
"images_data",
"==",
"0",
"]",
"=",
"np",
".",
"inf",
"min_image_data",
... | Create a min Image from a list of Images.
Parameters
----------
:obj:`list` of :obj:`Image`
A list of Image objects.
Returns
-------
:obj:`Image`
A new Image of the same type whose data is the min of all of
the images' data. | [
"Create",
"a",
"min",
"Image",
"from",
"a",
"list",
"of",
"Images",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L517-L540 | train | Create a min Image from a list of Images. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.apply | def apply(self, method, *args, **kwargs):
"""Create a new image by applying a function to this image's data.
Parameters
----------
method : :obj:`function`
A function to call on the data. This takes in a ndarray
as its first argument and optionally takes other ar... | python | def apply(self, method, *args, **kwargs):
"""Create a new image by applying a function to this image's data.
Parameters
----------
method : :obj:`function`
A function to call on the data. This takes in a ndarray
as its first argument and optionally takes other ar... | [
"def",
"apply",
"(",
"self",
",",
"method",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"method",
"(",
"self",
".",
"data",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"type",
"(",
"self",
")",
"(",
"data",
... | Create a new image by applying a function to this image's data.
Parameters
----------
method : :obj:`function`
A function to call on the data. This takes in a ndarray
as its first argument and optionally takes other arguments.
It should return a modified data... | [
"Create",
"a",
"new",
"image",
"by",
"applying",
"a",
"function",
"to",
"this",
"image",
"s",
"data",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L600-L623 | train | Create a new image by applying a function to the current image s data. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.crop | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | python | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | [
"def",
"crop",
"(",
"self",
",",
"height",
",",
"width",
",",
"center_i",
"=",
"None",
",",
"center_j",
"=",
"None",
")",
":",
"# compute crop center px",
"height",
"=",
"int",
"(",
"np",
".",
"round",
"(",
"height",
")",
")",
"width",
"=",
"int",
"(... | Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
The center height point at which to crop. If not specified, the... | [
"Crop",
"the",
"image",
"centered",
"around",
"center_i",
"center_j",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L635-L683 | train | Crop the image centered around center_i and center_j. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.focus | def focus(self, height, width, center_i=None, center_j=None):
"""Zero out all of the image outside of a crop box.
Parameters
----------
height : int
The height of the desired crop box.
width : int
The width of the desired crop box.
center_i : in... | python | def focus(self, height, width, center_i=None, center_j=None):
"""Zero out all of the image outside of a crop box.
Parameters
----------
height : int
The height of the desired crop box.
width : int
The width of the desired crop box.
center_i : in... | [
"def",
"focus",
"(",
"self",
",",
"height",
",",
"width",
",",
"center_i",
"=",
"None",
",",
"center_j",
"=",
"None",
")",
":",
"if",
"center_i",
"is",
"None",
":",
"center_i",
"=",
"self",
".",
"height",
"/",
"2",
"if",
"center_j",
"is",
"None",
"... | Zero out all of the image outside of a crop box.
Parameters
----------
height : int
The height of the desired crop box.
width : int
The width of the desired crop box.
center_i : int
The center height point of the crop box. If not specified, ... | [
"Zero",
"out",
"all",
"of",
"the",
"image",
"outside",
"of",
"a",
"crop",
"box",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L685-L723 | train | Zero out all of the image inside of a crop box. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.center_nonzero | def center_nonzero(self):
"""Recenters the image on the mean of the coordinates of nonzero pixels.
Returns
-------
:obj:`Image`
A new Image of the same type and size that is re-centered
at the mean location of the non-zero pixels.
"""
# get the ce... | python | def center_nonzero(self):
"""Recenters the image on the mean of the coordinates of nonzero pixels.
Returns
-------
:obj:`Image`
A new Image of the same type and size that is re-centered
at the mean location of the non-zero pixels.
"""
# get the ce... | [
"def",
"center_nonzero",
"(",
"self",
")",
":",
"# get the center of the nonzero pixels",
"nonzero_px",
"=",
"np",
".",
"where",
"(",
"self",
".",
"_data",
"!=",
"0.0",
")",
"nonzero_px",
"=",
"np",
".",
"c_",
"[",
"nonzero_px",
"[",
"0",
"]",
",",
"nonzer... | Recenters the image on the mean of the coordinates of nonzero pixels.
Returns
-------
:obj:`Image`
A new Image of the same type and size that is re-centered
at the mean location of the non-zero pixels. | [
"Recenters",
"the",
"image",
"on",
"the",
"mean",
"of",
"the",
"coordinates",
"of",
"nonzero",
"pixels",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L725-L759 | train | Return the center of the image of the same type and size that is re - centered at the mean location of the nonzero pixels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.nonzero_pixels | def nonzero_pixels(self):
""" Return an array of the nonzero pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the nonzero pixels
"""
nonzero_px = np.where(np.sum(self.raw_data, axis=2) > 0)
nonzero_px = np.c_[nonzero_px[0], nonzero_px[1]]
... | python | def nonzero_pixels(self):
""" Return an array of the nonzero pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the nonzero pixels
"""
nonzero_px = np.where(np.sum(self.raw_data, axis=2) > 0)
nonzero_px = np.c_[nonzero_px[0], nonzero_px[1]]
... | [
"def",
"nonzero_pixels",
"(",
"self",
")",
":",
"nonzero_px",
"=",
"np",
".",
"where",
"(",
"np",
".",
"sum",
"(",
"self",
".",
"raw_data",
",",
"axis",
"=",
"2",
")",
">",
"0",
")",
"nonzero_px",
"=",
"np",
".",
"c_",
"[",
"nonzero_px",
"[",
"0"... | Return an array of the nonzero pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the nonzero pixels | [
"Return",
"an",
"array",
"of",
"the",
"nonzero",
"pixels",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L761-L771 | train | Return an array of the nonzero pixels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.zero_pixels | def zero_pixels(self):
""" Return an array of the zero pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the zero pixels
"""
zero_px = np.where(np.sum(self.raw_data, axis=2) == 0)
zero_px = np.c_[zero_px[0], zero_px[1]]
return zero_px | python | def zero_pixels(self):
""" Return an array of the zero pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the zero pixels
"""
zero_px = np.where(np.sum(self.raw_data, axis=2) == 0)
zero_px = np.c_[zero_px[0], zero_px[1]]
return zero_px | [
"def",
"zero_pixels",
"(",
"self",
")",
":",
"zero_px",
"=",
"np",
".",
"where",
"(",
"np",
".",
"sum",
"(",
"self",
".",
"raw_data",
",",
"axis",
"=",
"2",
")",
"==",
"0",
")",
"zero_px",
"=",
"np",
".",
"c_",
"[",
"zero_px",
"[",
"0",
"]",
... | Return an array of the zero pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the zero pixels | [
"Return",
"an",
"array",
"of",
"the",
"zero",
"pixels",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L773-L783 | train | Return an array of the zero pixels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.nan_pixels | def nan_pixels(self):
""" Return an array of the NaN pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the NaN pixels
"""
nan_px = np.where(np.isnan(np.sum(self.raw_data, axis=2)))
nan_px = np.c_[nan_px[0], nan_px[1]]
return nan_px | python | def nan_pixels(self):
""" Return an array of the NaN pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the NaN pixels
"""
nan_px = np.where(np.isnan(np.sum(self.raw_data, axis=2)))
nan_px = np.c_[nan_px[0], nan_px[1]]
return nan_px | [
"def",
"nan_pixels",
"(",
"self",
")",
":",
"nan_px",
"=",
"np",
".",
"where",
"(",
"np",
".",
"isnan",
"(",
"np",
".",
"sum",
"(",
"self",
".",
"raw_data",
",",
"axis",
"=",
"2",
")",
")",
")",
"nan_px",
"=",
"np",
".",
"c_",
"[",
"nan_px",
... | Return an array of the NaN pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the NaN pixels | [
"Return",
"an",
"array",
"of",
"the",
"NaN",
"pixels",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L785-L795 | train | Return an array of the NaN pixels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.finite_pixels | def finite_pixels(self):
""" Return an array of the finite pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the finite pixels
"""
finite_px = np.where(np.isfinite(self.data))
finite_px = np.c_[finite_px[0], finite_px[1]]
return finit... | python | def finite_pixels(self):
""" Return an array of the finite pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the finite pixels
"""
finite_px = np.where(np.isfinite(self.data))
finite_px = np.c_[finite_px[0], finite_px[1]]
return finit... | [
"def",
"finite_pixels",
"(",
"self",
")",
":",
"finite_px",
"=",
"np",
".",
"where",
"(",
"np",
".",
"isfinite",
"(",
"self",
".",
"data",
")",
")",
"finite_px",
"=",
"np",
".",
"c_",
"[",
"finite_px",
"[",
"0",
"]",
",",
"finite_px",
"[",
"1",
"... | Return an array of the finite pixels.
Returns
-------
:obj:`numpy.ndarray`
Nx2 array of the finite pixels | [
"Return",
"an",
"array",
"of",
"the",
"finite",
"pixels",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L797-L807 | train | Return an array of the finite pixels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.replace_zeros | def replace_zeros(self, val, zero_thresh=0.0):
""" Replaces all zeros in the image with a specified value
Returns
-------
image dtype
value to replace zeros with
"""
new_data = self.data.copy()
new_data[new_data <= zero_thresh] = val
return t... | python | def replace_zeros(self, val, zero_thresh=0.0):
""" Replaces all zeros in the image with a specified value
Returns
-------
image dtype
value to replace zeros with
"""
new_data = self.data.copy()
new_data[new_data <= zero_thresh] = val
return t... | [
"def",
"replace_zeros",
"(",
"self",
",",
"val",
",",
"zero_thresh",
"=",
"0.0",
")",
":",
"new_data",
"=",
"self",
".",
"data",
".",
"copy",
"(",
")",
"new_data",
"[",
"new_data",
"<=",
"zero_thresh",
"]",
"=",
"val",
"return",
"type",
"(",
"self",
... | Replaces all zeros in the image with a specified value
Returns
-------
image dtype
value to replace zeros with | [
"Replaces",
"all",
"zeros",
"in",
"the",
"image",
"with",
"a",
"specified",
"value"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L820-L830 | train | Replaces all zeros in the image with a specified value. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.save | def save(self, filename):
"""Writes the image to a file.
Parameters
----------
filename : :obj:`str`
The file to save the image to. Must be one of .png, .jpg,
.npy, or .npz.
Raises
------
ValueError
If an unsupported file type... | python | def save(self, filename):
"""Writes the image to a file.
Parameters
----------
filename : :obj:`str`
The file to save the image to. Must be one of .png, .jpg,
.npy, or .npz.
Raises
------
ValueError
If an unsupported file type... | [
"def",
"save",
"(",
"self",
",",
"filename",
")",
":",
"filename",
"=",
"str",
"(",
"filename",
")",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"file_ext",
"in",
"COLOR_IMAGE_EXTS",
":",
"im_data",
... | Writes the image to a file.
Parameters
----------
filename : :obj:`str`
The file to save the image to. Must be one of .png, .jpg,
.npy, or .npz.
Raises
------
ValueError
If an unsupported file type is specified. | [
"Writes",
"the",
"image",
"to",
"a",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L832-L864 | train | Writes the image to a file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.savefig | def savefig(self, output_path, title, dpi=400, format='png', cmap=None):
"""Write the image to a file using pyplot.
Parameters
----------
output_path : :obj:`str`
The directory in which to place the file.
title : :obj:`str`
The title of the file in which... | python | def savefig(self, output_path, title, dpi=400, format='png', cmap=None):
"""Write the image to a file using pyplot.
Parameters
----------
output_path : :obj:`str`
The directory in which to place the file.
title : :obj:`str`
The title of the file in which... | [
"def",
"savefig",
"(",
"self",
",",
"output_path",
",",
"title",
",",
"dpi",
"=",
"400",
",",
"format",
"=",
"'png'",
",",
"cmap",
"=",
"None",
")",
":",
"plt",
".",
"figure",
"(",
")",
"plt",
".",
"imshow",
"(",
"self",
".",
"data",
",",
"cmap",... | Write the image to a file using pyplot.
Parameters
----------
output_path : :obj:`str`
The directory in which to place the file.
title : :obj:`str`
The title of the file in which to save the image.
dpi : int
The resolution in dots per inch.
... | [
"Write",
"the",
"image",
"to",
"a",
"file",
"using",
"pyplot",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L866-L899 | train | Write the image to a file using matplotlib. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | Image.load_data | def load_data(filename):
"""Loads a data matrix from a given file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
Returns
-------
:obj:`numpy.ndarray`
The ... | python | def load_data(filename):
"""Loads a data matrix from a given file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
Returns
-------
:obj:`numpy.ndarray`
The ... | [
"def",
"load_data",
"(",
"filename",
")",
":",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"data",
"=",
"None",
"if",
"file_ext",
".",
"lower",
"(",
")",
"in",
"COLOR_IMAGE_EXTS",
":",
"data",
"=",
"cv2"... | Loads a data matrix from a given file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
Returns
-------
:obj:`numpy.ndarray`
The data array read from the file. | [
"Loads",
"a",
"data",
"matrix",
"from",
"a",
"given",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L902-L926 | train | Loads a data matrix from a given file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage._check_valid_data | def _check_valid_data(self, data):
"""Checks that the given data is a uint8 array with one or three
channels.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid.
... | python | def _check_valid_data(self, data):
"""Checks that the given data is a uint8 array with one or three
channels.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid.
... | [
"def",
"_check_valid_data",
"(",
"self",
",",
"data",
")",
":",
"if",
"data",
".",
"dtype",
".",
"type",
"is",
"not",
"np",
".",
"uint8",
":",
"raise",
"ValueError",
"(",
"'Illegal data type. Color images only support uint8 arrays'",
")",
"if",
"len",
"(",
"da... | Checks that the given data is a uint8 array with one or three
channels.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid. | [
"Checks",
"that",
"the",
"given",
"data",
"is",
"a",
"uint8",
"array",
"with",
"one",
"or",
"three",
"channels",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L973-L993 | train | Checks that the given data is a uint8 array with one or three channels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.bgr2rgb | def bgr2rgb(self):
""" Converts data using the cv conversion. """
new_data = cv2.cvtColor(self.raw_data, cv2.COLOR_BGR2RGB)
return ColorImage(new_data, frame=self.frame, encoding='rgb8') | python | def bgr2rgb(self):
""" Converts data using the cv conversion. """
new_data = cv2.cvtColor(self.raw_data, cv2.COLOR_BGR2RGB)
return ColorImage(new_data, frame=self.frame, encoding='rgb8') | [
"def",
"bgr2rgb",
"(",
"self",
")",
":",
"new_data",
"=",
"cv2",
".",
"cvtColor",
"(",
"self",
".",
"raw_data",
",",
"cv2",
".",
"COLOR_BGR2RGB",
")",
"return",
"ColorImage",
"(",
"new_data",
",",
"frame",
"=",
"self",
".",
"frame",
",",
"encoding",
"=... | Converts data using the cv conversion. | [
"Converts",
"data",
"using",
"the",
"cv",
"conversion",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1024-L1027 | train | Converts data using cv2. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.rgb2bgr | def rgb2bgr(self):
""" Converts data using the cv conversion. """
new_data = cv2.cvtColor(self.raw_data, cv2.COLOR_RGB2BGR)
return ColorImage(new_data, frame=self.frame, encoding='bgr8') | python | def rgb2bgr(self):
""" Converts data using the cv conversion. """
new_data = cv2.cvtColor(self.raw_data, cv2.COLOR_RGB2BGR)
return ColorImage(new_data, frame=self.frame, encoding='bgr8') | [
"def",
"rgb2bgr",
"(",
"self",
")",
":",
"new_data",
"=",
"cv2",
".",
"cvtColor",
"(",
"self",
".",
"raw_data",
",",
"cv2",
".",
"COLOR_RGB2BGR",
")",
"return",
"ColorImage",
"(",
"new_data",
",",
"frame",
"=",
"self",
".",
"frame",
",",
"encoding",
"=... | Converts data using the cv conversion. | [
"Converts",
"data",
"using",
"the",
"cv",
"conversion",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1029-L1032 | train | Converts data using cv2. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.swap_channels | def swap_channels(self, channel_swap):
""" Swaps the two channels specified in the tuple.
Parameters
----------
channel_swap : :obj:`tuple` of int
the two channels to swap
Returns
-------
:obj:`ColorImage`
color image with cols swapped
... | python | def swap_channels(self, channel_swap):
""" Swaps the two channels specified in the tuple.
Parameters
----------
channel_swap : :obj:`tuple` of int
the two channels to swap
Returns
-------
:obj:`ColorImage`
color image with cols swapped
... | [
"def",
"swap_channels",
"(",
"self",
",",
"channel_swap",
")",
":",
"if",
"len",
"(",
"channel_swap",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'Illegal value for channel swap'",
")",
"ci",
"=",
"channel_swap",
"[",
"0",
"]",
"cj",
"=",
"channel_swap... | Swaps the two channels specified in the tuple.
Parameters
----------
channel_swap : :obj:`tuple` of int
the two channels to swap
Returns
-------
:obj:`ColorImage`
color image with cols swapped | [
"Swaps",
"the",
"two",
"channels",
"specified",
"in",
"the",
"tuple",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1034-L1056 | train | Swaps the two channels specified in the tuple. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.find_chessboard | def find_chessboard(self, sx=6, sy=9):
"""Finds the corners of an sx X sy chessboard in the image.
Parameters
----------
sx : int
Number of chessboard corners in x-direction.
sy : int
Number of chessboard corners in y-direction.
Returns
-... | python | def find_chessboard(self, sx=6, sy=9):
"""Finds the corners of an sx X sy chessboard in the image.
Parameters
----------
sx : int
Number of chessboard corners in x-direction.
sy : int
Number of chessboard corners in y-direction.
Returns
-... | [
"def",
"find_chessboard",
"(",
"self",
",",
"sx",
"=",
"6",
",",
"sy",
"=",
"9",
")",
":",
"# termination criteria",
"criteria",
"=",
"(",
"cv2",
".",
"TERM_CRITERIA_EPS",
"+",
"cv2",
".",
"TERM_CRITERIA_MAX_ITER",
",",
"30",
",",
"0.001",
")",
"# prepare ... | Finds the corners of an sx X sy chessboard in the image.
Parameters
----------
sx : int
Number of chessboard corners in x-direction.
sy : int
Number of chessboard corners in y-direction.
Returns
-------
:obj:`list` of :obj:`numpy.ndarray`... | [
"Finds",
"the",
"corners",
"of",
"an",
"sx",
"X",
"sy",
"chessboard",
"in",
"the",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1080-L1124 | train | Finds the corners of an sx X sy chessboard in the image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.foreground_mask | def foreground_mask(
self,
tolerance,
ignore_black=True,
use_hsv=False,
scale=8,
bgmodel=None):
"""Creates a binary image mask for the foreground of an image against
a uniformly colored background. The background is assumed to be th... | python | def foreground_mask(
self,
tolerance,
ignore_black=True,
use_hsv=False,
scale=8,
bgmodel=None):
"""Creates a binary image mask for the foreground of an image against
a uniformly colored background. The background is assumed to be th... | [
"def",
"foreground_mask",
"(",
"self",
",",
"tolerance",
",",
"ignore_black",
"=",
"True",
",",
"use_hsv",
"=",
"False",
",",
"scale",
"=",
"8",
",",
"bgmodel",
"=",
"None",
")",
":",
"# get a background model",
"if",
"bgmodel",
"is",
"None",
":",
"bgmodel... | Creates a binary image mask for the foreground of an image against
a uniformly colored background. The background is assumed to be the mode value of the histogram
for each of the color channels.
Parameters
----------
tolerance : int
A +/- level from the detected mean... | [
"Creates",
"a",
"binary",
"image",
"mask",
"for",
"the",
"foreground",
"of",
"an",
"image",
"against",
"a",
"uniformly",
"colored",
"background",
".",
"The",
"background",
"is",
"assumed",
"to",
"be",
"the",
"mode",
"value",
"of",
"the",
"histogram",
"for",
... | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1147-L1205 | train | Creates a binary image mask for the foreground of an image against the current color image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.background_model | def background_model(self, ignore_black=True, use_hsv=False, scale=8):
"""Creates a background model for the given image. The background
color is given by the modes of each channel's histogram.
Parameters
----------
ignore_black : bool
If True, the zero pixels will b... | python | def background_model(self, ignore_black=True, use_hsv=False, scale=8):
"""Creates a background model for the given image. The background
color is given by the modes of each channel's histogram.
Parameters
----------
ignore_black : bool
If True, the zero pixels will b... | [
"def",
"background_model",
"(",
"self",
",",
"ignore_black",
"=",
"True",
",",
"use_hsv",
"=",
"False",
",",
"scale",
"=",
"8",
")",
":",
"# hsv color",
"data",
"=",
"self",
".",
"data",
"if",
"use_hsv",
":",
"pil_im",
"=",
"PImage",
".",
"fromarray",
... | Creates a background model for the given image. The background
color is given by the modes of each channel's histogram.
Parameters
----------
ignore_black : bool
If True, the zero pixels will be ignored
when computing the background model.
use_hsv : bool... | [
"Creates",
"a",
"background",
"model",
"for",
"the",
"given",
"image",
".",
"The",
"background",
"color",
"is",
"given",
"by",
"the",
"modes",
"of",
"each",
"channel",
"s",
"histogram",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1207-L1260 | train | Creates a background model for the given image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.draw_box | def draw_box(self, box):
"""Draw a white box on the image.
Parameters
----------
:obj:`autolab_core.Box`
A 2D box to draw in the image.
Returns
-------
:obj:`ColorImage`
A new image that is the same as the current one, but with
... | python | def draw_box(self, box):
"""Draw a white box on the image.
Parameters
----------
:obj:`autolab_core.Box`
A 2D box to draw in the image.
Returns
-------
:obj:`ColorImage`
A new image that is the same as the current one, but with
... | [
"def",
"draw_box",
"(",
"self",
",",
"box",
")",
":",
"box_data",
"=",
"self",
".",
"_data",
".",
"copy",
"(",
")",
"min_i",
"=",
"box",
".",
"min_pt",
"[",
"1",
"]",
"min_j",
"=",
"box",
".",
"min_pt",
"[",
"0",
"]",
"max_i",
"=",
"box",
".",
... | Draw a white box on the image.
Parameters
----------
:obj:`autolab_core.Box`
A 2D box to draw in the image.
Returns
-------
:obj:`ColorImage`
A new image that is the same as the current one, but with
the white box drawn in. | [
"Draw",
"a",
"white",
"box",
"on",
"the",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1262-L1292 | train | Draw a white box on the image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.nonzero_hsv_data | def nonzero_hsv_data(self):
""" Computes non zero hsv values.
Returns
-------
:obj:`numpy.ndarray`
array of the hsv values for the image
"""
hsv_data = cv2.cvtColor(self.data, cv2.COLOR_BGR2HSV)
nonzero_px = self.nonzero_pixels()
return hsv_da... | python | def nonzero_hsv_data(self):
""" Computes non zero hsv values.
Returns
-------
:obj:`numpy.ndarray`
array of the hsv values for the image
"""
hsv_data = cv2.cvtColor(self.data, cv2.COLOR_BGR2HSV)
nonzero_px = self.nonzero_pixels()
return hsv_da... | [
"def",
"nonzero_hsv_data",
"(",
"self",
")",
":",
"hsv_data",
"=",
"cv2",
".",
"cvtColor",
"(",
"self",
".",
"data",
",",
"cv2",
".",
"COLOR_BGR2HSV",
")",
"nonzero_px",
"=",
"self",
".",
"nonzero_pixels",
"(",
")",
"return",
"hsv_data",
"[",
"nonzero_px",... | Computes non zero hsv values.
Returns
-------
:obj:`numpy.ndarray`
array of the hsv values for the image | [
"Computes",
"non",
"zero",
"hsv",
"values",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1294-L1304 | train | Computes non zero hsv values for the image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.segment_kmeans | def segment_kmeans(self, rgb_weight, num_clusters, hue_weight=0.0):
"""
Segment a color image using KMeans based on spatial and color distances.
Black pixels will automatically be assigned to their own 'background' cluster.
Parameters
----------
rgb_weight : float
... | python | def segment_kmeans(self, rgb_weight, num_clusters, hue_weight=0.0):
"""
Segment a color image using KMeans based on spatial and color distances.
Black pixels will automatically be assigned to their own 'background' cluster.
Parameters
----------
rgb_weight : float
... | [
"def",
"segment_kmeans",
"(",
"self",
",",
"rgb_weight",
",",
"num_clusters",
",",
"hue_weight",
"=",
"0.0",
")",
":",
"# form features array",
"label_offset",
"=",
"1",
"nonzero_px",
"=",
"np",
".",
"where",
"(",
"self",
".",
"data",
"!=",
"0.0",
")",
"no... | Segment a color image using KMeans based on spatial and color distances.
Black pixels will automatically be assigned to their own 'background' cluster.
Parameters
----------
rgb_weight : float
weighting of RGB distance relative to spatial and hue distance
num_cluster... | [
"Segment",
"a",
"color",
"image",
"using",
"KMeans",
"based",
"on",
"spatial",
"and",
"color",
"distances",
".",
"Black",
"pixels",
"will",
"automatically",
"be",
"assigned",
"to",
"their",
"own",
"background",
"cluster",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1306-L1346 | train | Segment a color image using KMeans based on spatial and color distances. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.inpaint | def inpaint(self, win_size=3, rescale_factor=1.0):
""" Fills in the zero pixels in the image.
Parameters
----------
win_size : int
size of window to use for inpainting
rescale_factor : float
amount to rescale the image for inpainting, smaller numbers incr... | python | def inpaint(self, win_size=3, rescale_factor=1.0):
""" Fills in the zero pixels in the image.
Parameters
----------
win_size : int
size of window to use for inpainting
rescale_factor : float
amount to rescale the image for inpainting, smaller numbers incr... | [
"def",
"inpaint",
"(",
"self",
",",
"win_size",
"=",
"3",
",",
"rescale_factor",
"=",
"1.0",
")",
":",
"# get original shape",
"orig_shape",
"=",
"(",
"self",
".",
"height",
",",
"self",
".",
"width",
")",
"# resize the image",
"resized_data",
"=",
"self",
... | Fills in the zero pixels in the image.
Parameters
----------
win_size : int
size of window to use for inpainting
rescale_factor : float
amount to rescale the image for inpainting, smaller numbers increase speed
Returns
-------
:obj:`Color... | [
"Fills",
"in",
"the",
"zero",
"pixels",
"in",
"the",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1348-L1380 | train | Fills in the zero pixels in the image with the inpainted image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.to_grayscale | def to_grayscale(self):
"""Converts the color image to grayscale using OpenCV.
Returns
-------
:obj:`GrayscaleImage`
Grayscale image corresponding to original color image.
"""
gray_data = cv2.cvtColor(self.data, cv2.COLOR_RGB2GRAY)
return GrayscaleIma... | python | def to_grayscale(self):
"""Converts the color image to grayscale using OpenCV.
Returns
-------
:obj:`GrayscaleImage`
Grayscale image corresponding to original color image.
"""
gray_data = cv2.cvtColor(self.data, cv2.COLOR_RGB2GRAY)
return GrayscaleIma... | [
"def",
"to_grayscale",
"(",
"self",
")",
":",
"gray_data",
"=",
"cv2",
".",
"cvtColor",
"(",
"self",
".",
"data",
",",
"cv2",
".",
"COLOR_RGB2GRAY",
")",
"return",
"GrayscaleImage",
"(",
"gray_data",
",",
"frame",
"=",
"self",
".",
"frame",
")"
] | Converts the color image to grayscale using OpenCV.
Returns
-------
:obj:`GrayscaleImage`
Grayscale image corresponding to original color image. | [
"Converts",
"the",
"color",
"image",
"to",
"grayscale",
"using",
"OpenCV",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1393-L1402 | train | Converts the color image to grayscale using OpenCV. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | ColorImage.open | def open(filename, frame='unspecified'):
"""Creates a ColorImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the f... | python | def open(filename, frame='unspecified'):
"""Creates a ColorImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the f... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"Image",
".",
"load_data",
"(",
"filename",
")",
".",
"astype",
"(",
"np",
".",
"uint8",
")",
"return",
"ColorImage",
"(",
"data",
",",
"frame",
")"
] | Creates a ColorImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the frame of reference in which the new image
... | [
"Creates",
"a",
"ColorImage",
"from",
"a",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1405-L1424 | train | Creates a ColorImage from a file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage._check_valid_data | def _check_valid_data(self, data):
"""Checks that the given data is a float array with one channel.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid.
"""
... | python | def _check_valid_data(self, data):
"""Checks that the given data is a float array with one channel.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid.
"""
... | [
"def",
"_check_valid_data",
"(",
"self",
",",
"data",
")",
":",
"if",
"data",
".",
"dtype",
".",
"type",
"is",
"not",
"np",
".",
"float32",
"and",
"data",
".",
"dtype",
".",
"type",
"is",
"not",
"np",
".",
"float64",
":",
"raise",
"ValueError",
"(",
... | Checks that the given data is a float array with one channel.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid. | [
"Checks",
"that",
"the",
"given",
"data",
"is",
"a",
"float",
"array",
"with",
"one",
"channel",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1457-L1477 | train | Checks that the given data is a float array with one channel. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage._image_data | def _image_data(self, normalize=False,
min_depth=MIN_DEPTH,
max_depth=MAX_DEPTH,
twobyte=False):
"""Returns the data in image format, with scaling and conversion to uint8 types.
Parameters
----------
normalize : bool
... | python | def _image_data(self, normalize=False,
min_depth=MIN_DEPTH,
max_depth=MAX_DEPTH,
twobyte=False):
"""Returns the data in image format, with scaling and conversion to uint8 types.
Parameters
----------
normalize : bool
... | [
"def",
"_image_data",
"(",
"self",
",",
"normalize",
"=",
"False",
",",
"min_depth",
"=",
"MIN_DEPTH",
",",
"max_depth",
"=",
"MAX_DEPTH",
",",
"twobyte",
"=",
"False",
")",
":",
"max_val",
"=",
"BINARY_IM_MAX_VAL",
"if",
"twobyte",
":",
"max_val",
"=",
"n... | Returns the data in image format, with scaling and conversion to uint8 types.
Parameters
----------
normalize : bool
whether or not to normalize by the min and max depth of the image
min_depth : float
minimum depth value for the normalization
max_depth : ... | [
"Returns",
"the",
"data",
"in",
"image",
"format",
"with",
"scaling",
"and",
"conversion",
"to",
"uint8",
"types",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1479-L1524 | train | Returns the data in image format with scaling and conversion to uint8 types. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.threshold | def threshold(self, front_thresh=0.0, rear_thresh=100.0):
"""Creates a new DepthImage by setting all depths less than
front_thresh and greater than rear_thresh to 0.
Parameters
----------
front_thresh : float
The lower-bound threshold.
rear_thresh : float
... | python | def threshold(self, front_thresh=0.0, rear_thresh=100.0):
"""Creates a new DepthImage by setting all depths less than
front_thresh and greater than rear_thresh to 0.
Parameters
----------
front_thresh : float
The lower-bound threshold.
rear_thresh : float
... | [
"def",
"threshold",
"(",
"self",
",",
"front_thresh",
"=",
"0.0",
",",
"rear_thresh",
"=",
"100.0",
")",
":",
"data",
"=",
"np",
".",
"copy",
"(",
"self",
".",
"_data",
")",
"data",
"[",
"data",
"<",
"front_thresh",
"]",
"=",
"0.0",
"data",
"[",
"d... | Creates a new DepthImage by setting all depths less than
front_thresh and greater than rear_thresh to 0.
Parameters
----------
front_thresh : float
The lower-bound threshold.
rear_thresh : float
The upper bound threshold.
Returns
-------... | [
"Creates",
"a",
"new",
"DepthImage",
"by",
"setting",
"all",
"depths",
"less",
"than",
"front_thresh",
"and",
"greater",
"than",
"rear_thresh",
"to",
"0",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1548-L1568 | train | Creates a new DepthImage by setting all depths less than front_thresh and greater than rear_thresh to 0. 0. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.threshold_gradients | def threshold_gradients(self, grad_thresh):
"""Creates a new DepthImage by zeroing out all depths
where the magnitude of the gradient at that point is
greater than grad_thresh.
Parameters
----------
grad_thresh : float
A threshold for the gradient magnitude.
... | python | def threshold_gradients(self, grad_thresh):
"""Creates a new DepthImage by zeroing out all depths
where the magnitude of the gradient at that point is
greater than grad_thresh.
Parameters
----------
grad_thresh : float
A threshold for the gradient magnitude.
... | [
"def",
"threshold_gradients",
"(",
"self",
",",
"grad_thresh",
")",
":",
"data",
"=",
"np",
".",
"copy",
"(",
"self",
".",
"_data",
")",
"gx",
",",
"gy",
"=",
"self",
".",
"gradients",
"(",
")",
"gradients",
"=",
"np",
".",
"zeros",
"(",
"[",
"gx",... | Creates a new DepthImage by zeroing out all depths
where the magnitude of the gradient at that point is
greater than grad_thresh.
Parameters
----------
grad_thresh : float
A threshold for the gradient magnitude.
Returns
-------
:obj:`DepthIma... | [
"Creates",
"a",
"new",
"DepthImage",
"by",
"zeroing",
"out",
"all",
"depths",
"where",
"the",
"magnitude",
"of",
"the",
"gradient",
"at",
"that",
"point",
"is",
"greater",
"than",
"grad_thresh",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1570-L1593 | train | Creates a new DepthImage by zeroing out all depths with magnitude greater than grad_thresh. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.threshold_gradients_pctile | def threshold_gradients_pctile(self, thresh_pctile, min_mag=0.0):
"""Creates a new DepthImage by zeroing out all depths
where the magnitude of the gradient at that point is
greater than some percentile of all gradients.
Parameters
----------
thresh_pctile : float
... | python | def threshold_gradients_pctile(self, thresh_pctile, min_mag=0.0):
"""Creates a new DepthImage by zeroing out all depths
where the magnitude of the gradient at that point is
greater than some percentile of all gradients.
Parameters
----------
thresh_pctile : float
... | [
"def",
"threshold_gradients_pctile",
"(",
"self",
",",
"thresh_pctile",
",",
"min_mag",
"=",
"0.0",
")",
":",
"data",
"=",
"np",
".",
"copy",
"(",
"self",
".",
"_data",
")",
"gx",
",",
"gy",
"=",
"self",
".",
"gradients",
"(",
")",
"gradients",
"=",
... | Creates a new DepthImage by zeroing out all depths
where the magnitude of the gradient at that point is
greater than some percentile of all gradients.
Parameters
----------
thresh_pctile : float
percentile to threshold all gradients above
min_mag : float
... | [
"Creates",
"a",
"new",
"DepthImage",
"by",
"zeroing",
"out",
"all",
"depths",
"where",
"the",
"magnitude",
"of",
"the",
"gradient",
"at",
"that",
"point",
"is",
"greater",
"than",
"some",
"percentile",
"of",
"all",
"gradients",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1595-L1623 | train | Creates a new DepthImage by zeroing out all depths with magnitude greater than some percentile of all gradients. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.inpaint | def inpaint(self, rescale_factor=1.0):
""" Fills in the zero pixels in the image.
Parameters
----------
rescale_factor : float
amount to rescale the image for inpainting, smaller numbers increase speed
Returns
-------
:obj:`DepthImage`
de... | python | def inpaint(self, rescale_factor=1.0):
""" Fills in the zero pixels in the image.
Parameters
----------
rescale_factor : float
amount to rescale the image for inpainting, smaller numbers increase speed
Returns
-------
:obj:`DepthImage`
de... | [
"def",
"inpaint",
"(",
"self",
",",
"rescale_factor",
"=",
"1.0",
")",
":",
"# get original shape",
"orig_shape",
"=",
"(",
"self",
".",
"height",
",",
"self",
".",
"width",
")",
"# form inpaint kernel",
"inpaint_kernel",
"=",
"np",
".",
"array",
"(",
"[",
... | Fills in the zero pixels in the image.
Parameters
----------
rescale_factor : float
amount to rescale the image for inpainting, smaller numbers increase speed
Returns
-------
:obj:`DepthImage`
depth image with zero pixels filled in | [
"Fills",
"in",
"the",
"zero",
"pixels",
"in",
"the",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1625-L1668 | train | In - place inpainting of the image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.invalid_pixel_mask | def invalid_pixel_mask(self):
""" Returns a binary mask for the NaN- and zero-valued pixels.
Serves as a mask for invalid pixels.
Returns
-------
:obj:`BinaryImage`
Binary image where a pixel value greater than zero indicates an invalid pixel.
"""
# i... | python | def invalid_pixel_mask(self):
""" Returns a binary mask for the NaN- and zero-valued pixels.
Serves as a mask for invalid pixels.
Returns
-------
:obj:`BinaryImage`
Binary image where a pixel value greater than zero indicates an invalid pixel.
"""
# i... | [
"def",
"invalid_pixel_mask",
"(",
"self",
")",
":",
"# init mask buffer",
"mask",
"=",
"np",
".",
"zeros",
"(",
"[",
"self",
".",
"height",
",",
"self",
".",
"width",
",",
"1",
"]",
")",
".",
"astype",
"(",
"np",
".",
"uint8",
")",
"# update invalid pi... | Returns a binary mask for the NaN- and zero-valued pixels.
Serves as a mask for invalid pixels.
Returns
-------
:obj:`BinaryImage`
Binary image where a pixel value greater than zero indicates an invalid pixel. | [
"Returns",
"a",
"binary",
"mask",
"for",
"the",
"NaN",
"-",
"and",
"zero",
"-",
"valued",
"pixels",
".",
"Serves",
"as",
"a",
"mask",
"for",
"invalid",
"pixels",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1670-L1687 | train | Returns a binary mask for the NaN - and zero - valued pixels. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.pixels_farther_than | def pixels_farther_than(self, depth_im, filter_equal_depth=False):
"""
Returns the pixels that are farther away
than those in the corresponding depth image.
Parameters
----------
depth_im : :obj:`DepthImage`
depth image to query replacement with
filte... | python | def pixels_farther_than(self, depth_im, filter_equal_depth=False):
"""
Returns the pixels that are farther away
than those in the corresponding depth image.
Parameters
----------
depth_im : :obj:`DepthImage`
depth image to query replacement with
filte... | [
"def",
"pixels_farther_than",
"(",
"self",
",",
"depth_im",
",",
"filter_equal_depth",
"=",
"False",
")",
":",
"# take closest pixel",
"if",
"filter_equal_depth",
":",
"farther_px",
"=",
"np",
".",
"where",
"(",
"(",
"self",
".",
"data",
">",
"depth_im",
".",
... | Returns the pixels that are farther away
than those in the corresponding depth image.
Parameters
----------
depth_im : :obj:`DepthImage`
depth image to query replacement with
filter_equal_depth : bool
whether or not to mark depth values that are equal
... | [
"Returns",
"the",
"pixels",
"that",
"are",
"farther",
"away",
"than",
"those",
"in",
"the",
"corresponding",
"depth",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1710-L1733 | train | Returns the pixels that are farther away than those in the corresponding depth image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.combine_with | def combine_with(self, depth_im):
"""
Replaces all zeros in the source depth image with the value of a different depth image
Parameters
----------
depth_im : :obj:`DepthImage`
depth image to combine with
Returns
-------
:obj:`DepthImage`
... | python | def combine_with(self, depth_im):
"""
Replaces all zeros in the source depth image with the value of a different depth image
Parameters
----------
depth_im : :obj:`DepthImage`
depth image to combine with
Returns
-------
:obj:`DepthImage`
... | [
"def",
"combine_with",
"(",
"self",
",",
"depth_im",
")",
":",
"new_data",
"=",
"self",
".",
"data",
".",
"copy",
"(",
")",
"# replace zero pixels",
"new_data",
"[",
"new_data",
"==",
"0",
"]",
"=",
"depth_im",
".",
"data",
"[",
"new_data",
"==",
"0",
... | Replaces all zeros in the source depth image with the value of a different depth image
Parameters
----------
depth_im : :obj:`DepthImage`
depth image to combine with
Returns
-------
:obj:`DepthImage`
the combined depth image | [
"Replaces",
"all",
"zeros",
"in",
"the",
"source",
"depth",
"image",
"with",
"the",
"value",
"of",
"a",
"different",
"depth",
"image"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1735-L1755 | train | Returns a new DepthImage object with the values of this DepthImage and the same depth image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.to_binary | def to_binary(self, threshold=0.0):
"""Creates a BinaryImage from the depth image. Points where the depth
is greater than threshold are converted to ones, and all other points
are zeros.
Parameters
----------
threshold : float
The depth threshold.
Re... | python | def to_binary(self, threshold=0.0):
"""Creates a BinaryImage from the depth image. Points where the depth
is greater than threshold are converted to ones, and all other points
are zeros.
Parameters
----------
threshold : float
The depth threshold.
Re... | [
"def",
"to_binary",
"(",
"self",
",",
"threshold",
"=",
"0.0",
")",
":",
"data",
"=",
"BINARY_IM_MAX_VAL",
"*",
"(",
"self",
".",
"_data",
">",
"threshold",
")",
"return",
"BinaryImage",
"(",
"data",
".",
"astype",
"(",
"np",
".",
"uint8",
")",
",",
... | Creates a BinaryImage from the depth image. Points where the depth
is greater than threshold are converted to ones, and all other points
are zeros.
Parameters
----------
threshold : float
The depth threshold.
Returns
-------
:obj:`BinaryImage... | [
"Creates",
"a",
"BinaryImage",
"from",
"the",
"depth",
"image",
".",
"Points",
"where",
"the",
"depth",
"is",
"greater",
"than",
"threshold",
"are",
"converted",
"to",
"ones",
"and",
"all",
"other",
"points",
"are",
"zeros",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1757-L1774 | train | Creates a BinaryImage from the depth image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.to_color | def to_color(self, normalize=False):
""" Convert to a color image.
Parameters
----------
normalize : bool
whether or not to normalize by the maximum depth
Returns
-------
:obj:`ColorImage`
color image corresponding to the depth image
... | python | def to_color(self, normalize=False):
""" Convert to a color image.
Parameters
----------
normalize : bool
whether or not to normalize by the maximum depth
Returns
-------
:obj:`ColorImage`
color image corresponding to the depth image
... | [
"def",
"to_color",
"(",
"self",
",",
"normalize",
"=",
"False",
")",
":",
"im_data",
"=",
"self",
".",
"_image_data",
"(",
"normalize",
"=",
"normalize",
")",
"return",
"ColorImage",
"(",
"im_data",
",",
"frame",
"=",
"self",
".",
"_frame",
")"
] | Convert to a color image.
Parameters
----------
normalize : bool
whether or not to normalize by the maximum depth
Returns
-------
:obj:`ColorImage`
color image corresponding to the depth image | [
"Convert",
"to",
"a",
"color",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1776-L1790 | train | Convert the image to a color image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.to_float | def to_float(self):
""" Converts to 32-bit data.
Returns
-------
:obj:`DepthImage`
depth image with 32 bit float data
"""
return DepthImage(self.data.astype(np.float32), frame=self.frame) | python | def to_float(self):
""" Converts to 32-bit data.
Returns
-------
:obj:`DepthImage`
depth image with 32 bit float data
"""
return DepthImage(self.data.astype(np.float32), frame=self.frame) | [
"def",
"to_float",
"(",
"self",
")",
":",
"return",
"DepthImage",
"(",
"self",
".",
"data",
".",
"astype",
"(",
"np",
".",
"float32",
")",
",",
"frame",
"=",
"self",
".",
"frame",
")"
] | Converts to 32-bit data.
Returns
-------
:obj:`DepthImage`
depth image with 32 bit float data | [
"Converts",
"to",
"32",
"-",
"bit",
"data",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1792-L1800 | train | Converts to 32 - bit float data. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.point_normal_cloud | def point_normal_cloud(self, camera_intr):
"""Computes a PointNormalCloud from the depth image.
Parameters
----------
camera_intr : :obj:`CameraIntrinsics`
The camera parameters on which this depth image was taken.
Returns
-------
:obj:`autolab_core.... | python | def point_normal_cloud(self, camera_intr):
"""Computes a PointNormalCloud from the depth image.
Parameters
----------
camera_intr : :obj:`CameraIntrinsics`
The camera parameters on which this depth image was taken.
Returns
-------
:obj:`autolab_core.... | [
"def",
"point_normal_cloud",
"(",
"self",
",",
"camera_intr",
")",
":",
"point_cloud_im",
"=",
"camera_intr",
".",
"deproject_to_image",
"(",
"self",
")",
"normal_cloud_im",
"=",
"point_cloud_im",
".",
"normal_cloud_im",
"(",
")",
"point_cloud",
"=",
"point_cloud_im... | Computes a PointNormalCloud from the depth image.
Parameters
----------
camera_intr : :obj:`CameraIntrinsics`
The camera parameters on which this depth image was taken.
Returns
-------
:obj:`autolab_core.PointNormalCloud`
A PointNormalCloud creat... | [
"Computes",
"a",
"PointNormalCloud",
"from",
"the",
"depth",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1802-L1822 | train | Computes a PointNormalCloud from the depth image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | DepthImage.open | def open(filename, frame='unspecified'):
"""Creates a DepthImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the f... | python | def open(filename, frame='unspecified'):
"""Creates a DepthImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the f... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"data",
"=",
"Image",
".",
"load_data",
"(",
"filename",
")",
"if",
"file_ext",
"... | Creates a DepthImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the frame of reference in which the new image
... | [
"Creates",
"a",
"DepthImage",
"from",
"a",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1825-L1847 | train | Creates a DepthImage from a file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | IrImage._image_data | def _image_data(self):
"""Returns the data in image format, with scaling and conversion to uint8 types.
Returns
-------
:obj:`numpy.ndarray` of uint8
A 3D matrix representing the image. The first dimension is rows, the
second is columns, and the third is simply t... | python | def _image_data(self):
"""Returns the data in image format, with scaling and conversion to uint8 types.
Returns
-------
:obj:`numpy.ndarray` of uint8
A 3D matrix representing the image. The first dimension is rows, the
second is columns, and the third is simply t... | [
"def",
"_image_data",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"_data",
"*",
"(",
"float",
"(",
"BINARY_IM_MAX_VAL",
")",
"/",
"MAX_IR",
")",
")",
".",
"astype",
"(",
"np",
".",
"uint8",
")"
] | Returns the data in image format, with scaling and conversion to uint8 types.
Returns
-------
:obj:`numpy.ndarray` of uint8
A 3D matrix representing the image. The first dimension is rows, the
second is columns, and the third is simply the IR entry scaled to between 0 an... | [
"Returns",
"the",
"data",
"in",
"image",
"format",
"with",
"scaling",
"and",
"conversion",
"to",
"uint8",
"types",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1897-L1906 | train | Returns the data in image format with scaling and conversion to uint8 types. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | IrImage.resize | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | python | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | [
"def",
"resize",
"(",
"self",
",",
"size",
",",
"interp",
"=",
"'bilinear'",
")",
":",
"resized_data",
"=",
"sm",
".",
"imresize",
"(",
"self",
".",
"_data",
",",
"size",
",",
"interp",
"=",
"interp",
")",
"return",
"IrImage",
"(",
"resized_data",
",",... | Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`, optional
Interpolation to use for re-si... | [
"Resize",
"the",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1908-L1928 | train | Resizes the image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | IrImage.open | def open(filename, frame='unspecified'):
"""Creates an IrImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the fra... | python | def open(filename, frame='unspecified'):
"""Creates an IrImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the fra... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"Image",
".",
"load_data",
"(",
"filename",
")",
"data",
"=",
"(",
"data",
"*",
"(",
"MAX_IR",
"/",
"BINARY_IM_MAX_VAL",
")",
")",
".",
"astype",
"(",
"np",
".... | Creates an IrImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the frame of reference in which the new image
l... | [
"Creates",
"an",
"IrImage",
"from",
"a",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1931-L1951 | train | Creates an IrImage from a file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | GrayscaleImage.resize | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | python | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | [
"def",
"resize",
"(",
"self",
",",
"size",
",",
"interp",
"=",
"'bilinear'",
")",
":",
"resized_data",
"=",
"sm",
".",
"imresize",
"(",
"self",
".",
"data",
",",
"size",
",",
"interp",
"=",
"interp",
")",
"return",
"GrayscaleImage",
"(",
"resized_data",
... | Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`, optional
Interpolation to use for re-si... | [
"Resize",
"the",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2014-L2034 | train | Resizes the image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | GrayscaleImage.to_color | def to_color(self):
"""Convert the grayscale image to a ColorImage.
Returns
-------
:obj:`ColorImage`
A color image equivalent to the grayscale one.
"""
color_data = np.repeat(self.data[:,:,np.newaxis], 3, axis=2)
return ColorImage(color_data, self._f... | python | def to_color(self):
"""Convert the grayscale image to a ColorImage.
Returns
-------
:obj:`ColorImage`
A color image equivalent to the grayscale one.
"""
color_data = np.repeat(self.data[:,:,np.newaxis], 3, axis=2)
return ColorImage(color_data, self._f... | [
"def",
"to_color",
"(",
"self",
")",
":",
"color_data",
"=",
"np",
".",
"repeat",
"(",
"self",
".",
"data",
"[",
":",
",",
":",
",",
"np",
".",
"newaxis",
"]",
",",
"3",
",",
"axis",
"=",
"2",
")",
"return",
"ColorImage",
"(",
"color_data",
",",
... | Convert the grayscale image to a ColorImage.
Returns
-------
:obj:`ColorImage`
A color image equivalent to the grayscale one. | [
"Convert",
"the",
"grayscale",
"image",
"to",
"a",
"ColorImage",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2036-L2045 | train | Convert the grayscale image to a ColorImage. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | GrayscaleImage.open | def open(filename, frame='unspecified'):
"""Creates a GrayscaleImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing t... | python | def open(filename, frame='unspecified'):
"""Creates a GrayscaleImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing t... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"Image",
".",
"load_data",
"(",
"filename",
")",
"return",
"GrayscaleImage",
"(",
"data",
",",
"frame",
")"
] | Creates a GrayscaleImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the frame of reference in which the new image
... | [
"Creates",
"a",
"GrayscaleImage",
"from",
"a",
"file",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2048-L2067 | train | Creates a GrayscaleImage from a file. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.pixelwise_or | def pixelwise_or(self, binary_im):
""" Takes OR operation with other binary image.
Parameters
----------
binary_im : :obj:`BinaryImage`
binary image for and operation
Returns
-------
:obj:`BinaryImage`
OR of this binary image and other im... | python | def pixelwise_or(self, binary_im):
""" Takes OR operation with other binary image.
Parameters
----------
binary_im : :obj:`BinaryImage`
binary image for and operation
Returns
-------
:obj:`BinaryImage`
OR of this binary image and other im... | [
"def",
"pixelwise_or",
"(",
"self",
",",
"binary_im",
")",
":",
"data",
"=",
"np",
".",
"copy",
"(",
"self",
".",
"_data",
")",
"ind",
"=",
"np",
".",
"where",
"(",
"binary_im",
".",
"data",
">",
"0",
")",
"data",
"[",
"ind",
"[",
"0",
"]",
","... | Takes OR operation with other binary image.
Parameters
----------
binary_im : :obj:`BinaryImage`
binary image for and operation
Returns
-------
:obj:`BinaryImage`
OR of this binary image and other image | [
"Takes",
"OR",
"operation",
"with",
"other",
"binary",
"image",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2179-L2195 | train | Takes OR operation with this binary image and other binary image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.inverse | def inverse(self):
""" Inverts image (all nonzeros become zeros and vice verse)
Returns
-------
:obj:`BinaryImage`
inverse of this binary image
"""
data = np.zeros(self.shape).astype(np.uint8)
ind = np.where(self.data == 0)
data[ind[0], ind[1],... | python | def inverse(self):
""" Inverts image (all nonzeros become zeros and vice verse)
Returns
-------
:obj:`BinaryImage`
inverse of this binary image
"""
data = np.zeros(self.shape).astype(np.uint8)
ind = np.where(self.data == 0)
data[ind[0], ind[1],... | [
"def",
"inverse",
"(",
"self",
")",
":",
"data",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"shape",
")",
".",
"astype",
"(",
"np",
".",
"uint8",
")",
"ind",
"=",
"np",
".",
"where",
"(",
"self",
".",
"data",
"==",
"0",
")",
"data",
"[",
"ind... | Inverts image (all nonzeros become zeros and vice verse)
Returns
-------
:obj:`BinaryImage`
inverse of this binary image | [
"Inverts",
"image",
"(",
"all",
"nonzeros",
"become",
"zeros",
"and",
"vice",
"verse",
")",
"Returns",
"-------",
":",
"obj",
":",
"BinaryImage",
"inverse",
"of",
"this",
"binary",
"image"
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2197-L2207 | train | Inverts image ( all nonzeros become zeros and vice verse )
returns a new binary image with the inverse of the image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.prune_contours | def prune_contours(self, area_thresh=1000.0, dist_thresh=20,
preserve_topology=True):
"""Removes all white connected components with area less than area_thresh.
Parameters
----------
area_thresh : float
The minimum area for which a white connected compo... | python | def prune_contours(self, area_thresh=1000.0, dist_thresh=20,
preserve_topology=True):
"""Removes all white connected components with area less than area_thresh.
Parameters
----------
area_thresh : float
The minimum area for which a white connected compo... | [
"def",
"prune_contours",
"(",
"self",
",",
"area_thresh",
"=",
"1000.0",
",",
"dist_thresh",
"=",
"20",
",",
"preserve_topology",
"=",
"True",
")",
":",
"# get all contours (connected components) from the binary image",
"contours",
",",
"hierarchy",
"=",
"cv2",
".",
... | Removes all white connected components with area less than area_thresh.
Parameters
----------
area_thresh : float
The minimum area for which a white connected component will not be
zeroed out.
dist_thresh : int
If a connected component is within dist_t... | [
"Removes",
"all",
"white",
"connected",
"components",
"with",
"area",
"less",
"than",
"area_thresh",
".",
"Parameters",
"----------",
"area_thresh",
":",
"float",
"The",
"minimum",
"area",
"for",
"which",
"a",
"white",
"connected",
"component",
"will",
"not",
"b... | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2209-L2290 | train | Removes all white connected components from the binary image. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.find_contours | def find_contours(self, min_area=0.0, max_area=np.inf):
"""Returns a list of connected components with an area between
min_area and max_area.
Parameters
----------
min_area : float
The minimum area for a contour
max_area : float
The maximum area fo... | python | def find_contours(self, min_area=0.0, max_area=np.inf):
"""Returns a list of connected components with an area between
min_area and max_area.
Parameters
----------
min_area : float
The minimum area for a contour
max_area : float
The maximum area fo... | [
"def",
"find_contours",
"(",
"self",
",",
"min_area",
"=",
"0.0",
",",
"max_area",
"=",
"np",
".",
"inf",
")",
":",
"# get all contours (connected components) from the binary image",
"_",
",",
"contours",
",",
"hierarchy",
"=",
"cv2",
".",
"findContours",
"(",
"... | Returns a list of connected components with an area between
min_area and max_area.
Parameters
----------
min_area : float
The minimum area for a contour
max_area : float
The maximum area for a contour
Returns
-------
:obj:`list` of ... | [
"Returns",
"a",
"list",
"of",
"connected",
"components",
"with",
"an",
"area",
"between",
"min_area",
"and",
"max_area",
".",
"Parameters",
"----------",
"min_area",
":",
"float",
"The",
"minimum",
"area",
"for",
"a",
"contour",
"max_area",
":",
"float",
"The"... | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2292-L2327 | train | Returns a list of Contour objects that are connected to the binary image containing the contour at the specified area. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.contour_mask | def contour_mask(self, contour):
""" Generates a binary image with only the given contour filled in. """
# fill in new data
new_data = np.zeros(self.data.shape)
num_boundary = contour.boundary_pixels.shape[0]
boundary_px_ij_swapped = np.zeros([num_boundary, 1, 2])
boundar... | python | def contour_mask(self, contour):
""" Generates a binary image with only the given contour filled in. """
# fill in new data
new_data = np.zeros(self.data.shape)
num_boundary = contour.boundary_pixels.shape[0]
boundary_px_ij_swapped = np.zeros([num_boundary, 1, 2])
boundar... | [
"def",
"contour_mask",
"(",
"self",
",",
"contour",
")",
":",
"# fill in new data",
"new_data",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"data",
".",
"shape",
")",
"num_boundary",
"=",
"contour",
".",
"boundary_pixels",
".",
"shape",
"[",
"0",
"]",
"bo... | Generates a binary image with only the given contour filled in. | [
"Generates",
"a",
"binary",
"image",
"with",
"only",
"the",
"given",
"contour",
"filled",
"in",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2329-L2344 | train | Generates a binary image with only the given contour filled in. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.boundary_map | def boundary_map(self):
""" Computes the boundary pixels in the image and sets them to nonzero values.
Returns
-------
:obj:`BinaryImage`
binary image with nonzeros on the boundary of the original image
"""
# compute contours
contours = self.find_cont... | python | def boundary_map(self):
""" Computes the boundary pixels in the image and sets them to nonzero values.
Returns
-------
:obj:`BinaryImage`
binary image with nonzeros on the boundary of the original image
"""
# compute contours
contours = self.find_cont... | [
"def",
"boundary_map",
"(",
"self",
")",
":",
"# compute contours",
"contours",
"=",
"self",
".",
"find_contours",
"(",
")",
"# fill in nonzero pixels",
"new_data",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"data",
".",
"shape",
")",
"for",
"contour",
"in",... | Computes the boundary pixels in the image and sets them to nonzero values.
Returns
-------
:obj:`BinaryImage`
binary image with nonzeros on the boundary of the original image | [
"Computes",
"the",
"boundary",
"pixels",
"in",
"the",
"image",
"and",
"sets",
"them",
"to",
"nonzero",
"values",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2346-L2362 | train | Computes the boundary pixels in the image and sets them to nonzero values. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.closest_pixel_to_set | def closest_pixel_to_set(self, start, pixel_set, direction, w=13, t=0.5):
"""Starting at pixel, moves start by direction * t until there is a
pixel from pixel_set within a radius w of start. Then, returns start.
Parameters
----------
start : :obj:`numpy.ndarray` of float
... | python | def closest_pixel_to_set(self, start, pixel_set, direction, w=13, t=0.5):
"""Starting at pixel, moves start by direction * t until there is a
pixel from pixel_set within a radius w of start. Then, returns start.
Parameters
----------
start : :obj:`numpy.ndarray` of float
... | [
"def",
"closest_pixel_to_set",
"(",
"self",
",",
"start",
",",
"pixel_set",
",",
"direction",
",",
"w",
"=",
"13",
",",
"t",
"=",
"0.5",
")",
":",
"# create circular structure for checking clearance",
"y",
",",
"x",
"=",
"np",
".",
"meshgrid",
"(",
"np",
"... | Starting at pixel, moves start by direction * t until there is a
pixel from pixel_set within a radius w of start. Then, returns start.
Parameters
----------
start : :obj:`numpy.ndarray` of float
The initial pixel location at which to start.
pixel_set : set of 2-tupl... | [
"Starting",
"at",
"pixel",
"moves",
"start",
"by",
"direction",
"*",
"t",
"until",
"there",
"is",
"a",
"pixel",
"from",
"pixel_set",
"within",
"a",
"radius",
"w",
"of",
"start",
".",
"Then",
"returns",
"start",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2364-L2426 | train | Finds the closest set of pixels from start to pixel_set. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.closest_allzero_pixel | def closest_allzero_pixel(self, pixel, direction, w=13, t=0.5):
"""Starting at pixel, moves pixel by direction * t until all
zero pixels within a radius w of pixel. Then, returns pixel.
Parameters
----------
pixel : :obj:`numpy.ndarray` of float
The initial pixel loc... | python | def closest_allzero_pixel(self, pixel, direction, w=13, t=0.5):
"""Starting at pixel, moves pixel by direction * t until all
zero pixels within a radius w of pixel. Then, returns pixel.
Parameters
----------
pixel : :obj:`numpy.ndarray` of float
The initial pixel loc... | [
"def",
"closest_allzero_pixel",
"(",
"self",
",",
"pixel",
",",
"direction",
",",
"w",
"=",
"13",
",",
"t",
"=",
"0.5",
")",
":",
"# create circular structure for checking clearance",
"y",
",",
"x",
"=",
"np",
".",
"meshgrid",
"(",
"np",
".",
"arange",
"("... | Starting at pixel, moves pixel by direction * t until all
zero pixels within a radius w of pixel. Then, returns pixel.
Parameters
----------
pixel : :obj:`numpy.ndarray` of float
The initial pixel location at which to start.
direction : :obj:`numpy.ndarray` of float... | [
"Starting",
"at",
"pixel",
"moves",
"pixel",
"by",
"direction",
"*",
"t",
"until",
"all",
"zero",
"pixels",
"within",
"a",
"radius",
"w",
"of",
"pixel",
".",
"Then",
"returns",
"pixel",
"."
] | 03d9b37dd6b66896cdfe173905c9413c8c3c5df6 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2484-L2542 | train | Finds the closest all zero pixels in a 2D direction vector. | GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.