37 for (
int i = 0; i < num_pixels; i++) {
38 const float *pixel = rgba + 4 * i;
40 gray[i] = weight_red * pixel[0] + weight_green * pixel[1] + weight_blue * pixel[2];
51 for (
int i = 0; i < num_pixels; i++) {
52 const uchar *pixel = rgba + i * 4;
54 gray[i] = (weight_red * pixel[0] + weight_green * pixel[1] + weight_blue * pixel[2]) / 255.0f;
77 width = searchibuf->
x;
78 height = searchibuf->
y;
84 searchibuf->
float_data(), gray_pixels, width * height, 0.2126f, 0.7152f, 0.0722f);
88 searchibuf->
byte_data(), gray_pixels, width * height, 0.2126f, 0.7152f, 0.0722f);
131 if (marker_keyed ==
nullptr) {
135 keyed_framenr = marker_keyed->
framenr;
137 *r_marker_keyed = marker_keyed;
151 ImBuf *ibuf =
nullptr;
155 clip, user, clip_flag, track, curfra, backwards, reference_marker);
169 const bool is_backwards,
191 options->image1_mask =
nullptr;
205 float *reference_search_area,
206 int reference_search_area_width,
207 int reference_search_area_height,
209 const bool is_backward,
210 double dst_pixel_x[5],
211 double dst_pixel_y[5])
214 double src_pixel_x[5], src_pixel_y[5];
222 int new_search_area_width, new_search_area_height;
223 int frame_width, frame_height;
227 frame_width = destination_ibuf->
x;
228 frame_height = destination_ibuf->
y;
235 destination_ibuf, track, marker, &new_search_area_width, &new_search_area_height);
243 frame_width, frame_height, reference_marker, src_pixel_x, src_pixel_y);
245 frame_width, frame_height, marker, dst_pixel_x, dst_pixel_y);
247 if (patch_new ==
nullptr || reference_search_area ==
nullptr) {
253 reference_search_area,
254 reference_search_area_width,
255 reference_search_area_height,
257 new_search_area_width,
258 new_search_area_height,
265 MEM_delete(patch_new);
273 int *reference_framenr)
279 while (reference >= first_marker && reference <= last_marker &&
290 if (reference < first_marker || reference > last_marker) {
294 *reference_framenr = reference->
framenr;
304 ImBuf *reference_ibuf, *destination_ibuf;
305 float *search_area, *
mask =
nullptr;
306 int frame_width, frame_height;
307 int search_area_height, search_area_width;
309 int reference_framenr;
311 double dst_pixel_x[5], dst_pixel_y[5];
325 clip, &user, clip_flag, track, reference_framenr, backwards, &reference_marker);
326 if (reference_ibuf ==
nullptr) {
331 if (reference_marker == marker) {
338 if (destination_ibuf ==
nullptr) {
345 reference_ibuf, track, reference_marker, &search_area_width, &search_area_height);
368 frame_width, frame_height, marker, dst_pixel_x, dst_pixel_y);
373 MEM_delete(search_area);
Read Blender memory allocation and freeing.
CCL_NAMESPACE_BEGIN struct Options options
@ LIBMV_TRACK_REGION_FORWARD
@ LIBMV_TRACK_REGION_BACKWARD
@ TRACK_ALGORITHM_FLAG_USE_NORMALIZATION
@ TRACK_ALGORITHM_FLAG_USE_MASK
@ TRACK_ALGORITHM_FLAG_USE_BRUTE
void BKE_movieclip_get_size(MovieClip *clip, const MovieClipUser *user, int *r_width, int *r_height)
static ImBuf * tracking_context_get_reference_ibuf(MovieClip *clip, MovieClipUser *user, MovieClipFlag clip_flag, MovieTrackingTrack *track, int curfra, bool backwards, MovieTrackingMarker **reference_marker)
ImBuf * BKE_tracking_get_search_imbuf(const ImBuf *ibuf, const MovieTrackingTrack *track, const MovieTrackingMarker *marker, bool anchored, bool disable_channels)
static ImBuf * tracking_context_get_keyframed_ibuf(MovieClip *clip, MovieClipUser *user, MovieClipFlag clip_flag, MovieTrackingTrack *track, int curfra, bool backwards, MovieTrackingMarker **r_marker_keyed)
void BKE_tracking_refine_marker(MovieClip *clip, MovieTrackingTrack *track, MovieTrackingMarker *marker, bool backwards)
static float * track_get_search_floatbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, int *r_width, int *r_height)
static void uint8_rgba_to_float_gray(const uchar *rgba, float *gray, int num_pixels, float weight_red, float weight_green, float weight_blue)
static bool refine_marker_reference_frame_get(MovieTrackingTrack *track, MovieTrackingMarker *marker, bool backwards, int *reference_framenr)
MovieTrackingMarker * tracking_get_keyframed_marker(MovieTrackingTrack *track, int current_frame, bool backwards)
void IMB_freeImBuf(ImBuf *ibuf)
static void float_rgba_to_gray(const float *rgba, float *gray, int num_pixels, float weight_red, float weight_green, float weight_blue)
void tracking_set_marker_coords_from_tracking(int frame_width, int frame_height, MovieTrackingMarker *marker, const double search_pixel_x[5], const double search_pixel_y[5])
void tracking_configure_tracker(const MovieTrackingTrack *track, float *mask, bool is_backwards, libmv_TrackRegionOptions *options)
float * BKE_tracking_track_get_mask(int frame_width, int frame_height, const MovieTrackingTrack *track, const MovieTrackingMarker *marker)
static bool configure_and_run_tracker(ImBuf *destination_ibuf, MovieTrackingTrack *track, MovieTrackingMarker *reference_marker, MovieTrackingMarker *marker, float *reference_search_area, int reference_search_area_width, int reference_search_area_height, float *mask, const bool is_backward, double dst_pixel_x[5], double dst_pixel_y[5])
ImBuf * BKE_movieclip_get_ibuf_flag(MovieClip *clip, const MovieClipUser *user, MovieClipFlag flag, MovieClipCacheFlag cache_flag)
float BKE_movieclip_remap_clip_to_scene_frame(const MovieClip *clip, float framenr)
static ImBuf * tracking_context_get_frame_ibuf(MovieClip *clip, MovieClipUser *user, MovieClipFlag clip_flag, int framenr)
void tracking_get_marker_coords_for_tracking(int frame_width, int frame_height, const MovieTrackingMarker *marker, double search_pixel_x[5], double search_pixel_y[5])
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
MovieTrackingMarker * BKE_tracking_marker_get(MovieTrackingTrack *track, int framenr)
const uint8_t * byte_data() const
const float * float_data() const
TrackingMotionModel motion_model
float minimum_correlation
MovieTrackingMarker * markers
TrackingAlgorithmFlag algorithm_flag
eTrackFrameMatch pattern_match
int libmv_trackRegion(const libmv_TrackRegionOptions *, const float *, int, int, const float *, int, int, const double *x1, const double *y1, libmv_TrackRegionResult *result, double *x2, double *y2)