MCPcopy Create free account
hub / github.com/creatale/node-dv / icvAdjustRect

Function icvAdjustRect

deps/opencv/modules/imgproc/src/samplers.cpp:80–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79
80static const void*
81icvAdjustRect( const void* srcptr, int src_step, int pix_size,
82 CvSize src_size, CvSize win_size,
83 CvPoint ip, CvRect* pRect )
84{
85 CvRect rect;
86 const char* src = (const char*)srcptr;
87
88 if( ip.x >= 0 )
89 {
90 src += ip.x*pix_size;
91 rect.x = 0;
92 }
93 else
94 {
95 rect.x = -ip.x;
96 if( rect.x > win_size.width )
97 rect.x = win_size.width;
98 }
99
100 if( ip.x < src_size.width - win_size.width )
101 rect.width = win_size.width;
102 else
103 {
104 rect.width = src_size.width - ip.x - 1;
105 if( rect.width < 0 )
106 {
107 src += rect.width*pix_size;
108 rect.width = 0;
109 }
110 assert( rect.width <= win_size.width );
111 }
112
113 if( ip.y >= 0 )
114 {
115 src += ip.y * src_step;
116 rect.y = 0;
117 }
118 else
119 rect.y = -ip.y;
120
121 if( ip.y < src_size.height - win_size.height )
122 rect.height = win_size.height;
123 else
124 {
125 rect.height = src_size.height - ip.y - 1;
126 if( rect.height < 0 )
127 {
128 src += rect.height*src_step;
129 rect.height = 0;
130 }
131 }
132
133 *pRect = rect;
134 return src - rect.x*pix_size;
135}
136
137

Callers 2

samplers.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected