LArOpenCV  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Namespaces | Classes | Typedefs | Functions | Variables
larcv Namespace Reference

C++ namespace for developping LArTPC software interface to OpenCV based algorithm tools (LArOpenCV) More...

Namespaces

 convert
 C++ namespace for a collection of Python<=>LArOpenCV C++ object conversion functions/classes.
 
 msg
 Namespace for larcv message related types.
 

Classes

class  ImageManager
 A utility container class for multiple image objects with corresponding metadata per image. More...
 
class  laropencv_base
 Very base class of all everything else defined in this framework. More...
 
class  Point2DArray
 An array of 2D points implemented as 1D std::vector<double> for I/O performance It is meant to be used to store larcv::Contour_t in a ROOT file but not yet implemented (ignore!) More...
 
class  EmptyImageCluster
 A simple clustering algorithm meant to serve for testing/example by Kazu. More...
 
class  EmptyImageClusterFactory
 A concrete factory class for larcv::EmptyImageCluster. More...
 
class  ImageClusterBase
 An abstract base class for ImageCluster algorithms. More...
 
class  ImageClusterFactoryBase
 Abstract base class for factory (to be implemented per algorithm) More...
 
class  ImageClusterFactory
 Factory class for instantiating algorithm instance by larcv::ImageClusterManager This factory class can instantiate a specified algorithm instance w/ provided instance name. More...
 
class  ImageClusterManager
 Class to execute a chain of algorithms to a given image input. More...
 
class  SBCluster
 
class  SBClusterFactory
 A concrete factory class for larcv::SBCluster. More...
 
class  ToyImageCluster
 A simple clustering algorithm meant to serve for testing/example by Kazu. More...
 
class  ToyImageClusterFactory
 A concrete factory class for larcv::ToyImageCluster. More...
 
class  Watch
 a very simple stopwatch class for simple time measurement More...
 
class  Image2D
 Borrowed from larcaffe (see larcaffe::Image2D) More...
 
class  ImageMeta
 Borrowed from larcaffe (see larcaffe::ImageMeta) More...
 
class  larbys
 Borrowed from larcaffe (see larcaffe::larbys) More...
 

Typedefs

typedef ::larcaffe::Image2D Image2D
 
typedef ::larcaffe::ImageMeta ImageMeta
 
typedef ::larcaffe::larbys larbys
 
typedef ::larcaffe::Point2D Point2D
 Stolen from larcaffe. More...
 
typedef ::larcaffe::logger logger
 
typedef size_t AlgorithmID_t
 larcv::ImageClusterBase inherit algorithm's unique identifier within larcv::ClusterImageManager More...
 
typedef size_t ClusterID_t
 A cluster's unique identifier within larcv::ClusterImageManager. More...
 
typedef std::vector< cv::Point > Contour_t
 A 2D contour type. More...
 
typedef std::vector
< larcv::Contour_t
ContourArray_t
 A set of 2D contours. More...
 

Functions

::cv::Rect BoundingBox (const larcv::Contour_t &cluster)
 
::cv::Mat CreateSubMatRef (const larcv::Contour_t &cluster, cv::Mat &img)
 
::cv::Mat CreateSubMatCopy (const larcv::Contour_t &cluster, const cv::Mat &img)
 

Variables

static const size_t kINVALID_SIZE = std::numeric_limits<size_t>::max()
 Used as an invalid value identifier for size_t. More...
 
static const int kINVALID_INT = std::numeric_limits<int>::max()
 Used as an invalid value identifier for int. More...
 
static EmptyImageClusterFactory __global_EmptyImageClusterFactory__
 Global larcv::EmptyImageClusterFactory to register ImageClusterFactory. More...
 
static const size_t kINVALID_ID = larcv::kINVALID_SIZE
 A constant to signify invalid "id" in general. More...
 
static const AlgorithmID_t kINVALID_ALGO_ID = kINVALID_ID
 A constant to signify, in particular, an invalid larcv::AlgorithmID_t. More...
 
static const ClusterID_t kINVALID_CLUSTER_ID = kINVALID_ID
 A constant to signify, in particular, an invalid larcv::ClusterID_t. More...
 
static SBClusterFactory __global_SBClusterFactory__
 Global larcv::SBClusterFactory to register ImageClusterFactory. More...
 
static ToyImageClusterFactory __global_ToyImageClusterFactory__
 Global larcv::ToyImageClusterFactory to register ImageClusterFactory. More...
 

Detailed Description

C++ namespace for developping LArTPC software interface to OpenCV based algorithm tools (LArOpenCV)

Typedef Documentation

typedef size_t larcv::AlgorithmID_t

larcv::ImageClusterBase inherit algorithm's unique identifier within larcv::ClusterImageManager

Definition at line 10 of file ImageClusterTypes.h.

typedef size_t larcv::ClusterID_t

A cluster's unique identifier within larcv::ClusterImageManager.

Definition at line 12 of file ImageClusterTypes.h.

typedef std::vector<cv::Point> larcv::Contour_t

A 2D contour type.

Definition at line 14 of file ImageClusterTypes.h.

A set of 2D contours.

Definition at line 16 of file ImageClusterTypes.h.

Definition at line 68 of file Image2D.h.

Definition at line 103 of file ImageMeta.h.

Definition at line 52 of file larbys.h.

Definition at line 24 of file laropencv_logger.h.

Stolen from larcaffe.

Definition at line 37 of file LArCVTypes.h.

Function Documentation

cv::Rect larcv::BoundingBox ( const larcv::Contour_t cluster)

Definition at line 10 of file Utilities.cxx.

Referenced by CreateSubMatCopy(), and CreateSubMatRef().

11  {
12  if(cluster.size()<2)
13  throw larbys("Cannot create SubMatrix for a contour of size < 2!");
14 
15  int x_min = INT_MAX;
16  int y_min = INT_MAX;
17  int x_max = 0;
18  int y_max = 0;
19 
20  for(auto const& pt : cluster) {
21 
22  if(pt.x < x_min) x_min = pt.x;
23  if(pt.x > x_max) x_max = pt.x;
24  if(pt.y < y_min) y_min = pt.y;
25  if(pt.y > y_max) y_max = pt.y;
26 
27  }
28 
29  return ::cv::Rect( x_min, y_min,
30  x_max - x_min + 1,
31  y_max - y_min + 1);
32  }
cv::Mat larcv::CreateSubMatCopy ( const larcv::Contour_t cluster,
const cv::Mat &  img 
)

Definition at line 47 of file Utilities.cxx.

References BoundingBox().

48  {
49  if(cluster.size()<2)
50  throw larbys("Cannot create SubMatrix for a contour of size < 2!");
51 
52  auto bbox = BoundingBox(cluster);
53 
54  ::cv::Mat result = ::cv::Mat::zeros(img.size(),img.type());
55 
56  for(int x=0; x<img.rows; ++x) {
57 
58  for(int y=0; y<img.cols; ++y) {
59 
60  int submat_x = x - bbox.x;
61  int submat_y = y - bbox.y;
62 
63  double inside = ::cv::pointPolygonTest(cluster,::cv::Point2f(x,y),false);
64 
65  if(inside<0) continue;
66 
67  result.at<float>(submat_x,submat_y,0) = img.at<float>(x,y,0);
68  }
69 
70  }
71 
72  return result;
73  }
cv::Mat larcv::CreateSubMatRef ( const larcv::Contour_t cluster,
cv::Mat &  img 
)

Definition at line 34 of file Utilities.cxx.

References BoundingBox().

35  {
36  if(cluster.size()<2)
37  throw larbys("Cannot create SubMatrix for a contour of size < 2!");
38 
39  auto bbox = BoundingBox(cluster);
40 
41  ::cv::Mat result;
42  img(bbox).copyTo(result);
43 
44  return result;
45  }

Variable Documentation

EmptyImageClusterFactory larcv::__global_EmptyImageClusterFactory__
static

Global larcv::EmptyImageClusterFactory to register ImageClusterFactory.

Definition at line 65 of file EmptyImageCluster.h.

SBClusterFactory larcv::__global_SBClusterFactory__
static

Global larcv::SBClusterFactory to register ImageClusterFactory.

Definition at line 60 of file SBCluster.h.

ToyImageClusterFactory larcv::__global_ToyImageClusterFactory__
static

Global larcv::ToyImageClusterFactory to register ImageClusterFactory.

Definition at line 65 of file ToyImageCluster.h.

const AlgorithmID_t larcv::kINVALID_ALGO_ID = kINVALID_ID
static

A constant to signify, in particular, an invalid larcv::AlgorithmID_t.

Definition at line 20 of file ImageClusterTypes.h.

Referenced by larcv::ImageClusterManager::ClusterID(), larcv::ImageClusterManager::Clusters(), and larcv::ImageClusterManager::GetAlgID().

const ClusterID_t larcv::kINVALID_CLUSTER_ID = kINVALID_ID
static

A constant to signify, in particular, an invalid larcv::ClusterID_t.

Definition at line 22 of file ImageClusterTypes.h.

Referenced by larcv::ImageClusterManager::ClusterID(), and larlite::LArImageHit::store_clusters().

const size_t larcv::kINVALID_ID = larcv::kINVALID_SIZE
static

A constant to signify invalid "id" in general.

Definition at line 18 of file ImageClusterTypes.h.

const int larcv::kINVALID_INT = std::numeric_limits<int>::max()
static

Used as an invalid value identifier for int.

Definition at line 35 of file LArCVTypes.h.

const size_t larcv::kINVALID_SIZE = std::numeric_limits<size_t>::max()
static

Used as an invalid value identifier for size_t.

Definition at line 33 of file LArCVTypes.h.