Internal change
PiperOrigin-RevId: 521970274
This commit is contained in:
parent
1990fe00d3
commit
7417e48da4
|
@ -214,7 +214,7 @@ double BorderDetectionCalculator::ColorCount(const Color& mask_color,
|
|||
const cv::Mat& image) const {
|
||||
int background_count = 0;
|
||||
for (int i = 0; i < image.rows; i++) {
|
||||
const uint8* row_ptr = image.ptr<uint8>(i);
|
||||
const uint8_t* row_ptr = image.ptr<uint8_t>(i);
|
||||
for (int j = 0; j < image.cols * 3; j += 3) {
|
||||
if (std::abs(mask_color.r() - static_cast<int>(row_ptr[j + 2])) <=
|
||||
options_.color_tolerance() &&
|
||||
|
|
|
@ -142,7 +142,7 @@ class ContentZoomingCalculator : public CalculatorBase {
|
|||
// Stores the first crop rectangle.
|
||||
mediapipe::NormalizedRect first_rect_;
|
||||
// Stores the time of the last "only_required" input.
|
||||
int64 last_only_required_detection_;
|
||||
int64_t last_only_required_detection_;
|
||||
// Rect values of last message with detection(s).
|
||||
int last_measured_height_;
|
||||
int last_measured_x_offset_;
|
||||
|
@ -500,7 +500,7 @@ bool ContentZoomingCalculator::IsAnimatingToFirstRect(
|
|||
return false;
|
||||
}
|
||||
|
||||
const int64 delta_us = (timestamp - first_rect_timestamp_).Value();
|
||||
const int64_t delta_us = (timestamp - first_rect_timestamp_).Value();
|
||||
return (0 <= delta_us && delta_us <= options_.us_to_first_rect());
|
||||
}
|
||||
|
||||
|
@ -522,8 +522,8 @@ absl::StatusOr<mediapipe::Rect> ContentZoomingCalculator::GetAnimationRect(
|
|||
RET_CHECK(IsAnimatingToFirstRect(timestamp))
|
||||
<< "Must only be called if animating to first rect.";
|
||||
|
||||
const int64 delta_us = (timestamp - first_rect_timestamp_).Value();
|
||||
const int64 delay = options_.us_to_first_rect_delay();
|
||||
const int64_t delta_us = (timestamp - first_rect_timestamp_).Value();
|
||||
const int64_t delay = options_.us_to_first_rect_delay();
|
||||
const double interpolation = easeInOutQuad(std::max(
|
||||
0.0, (delta_us - delay) /
|
||||
static_cast<double>(options_.us_to_first_rect() - delay)));
|
||||
|
|
|
@ -226,7 +226,7 @@ struct AddDetectionFlags {
|
|||
std::optional<int> max_zoom_factor_percent;
|
||||
};
|
||||
|
||||
void AddDetectionFrameSize(const cv::Rect_<float>& position, const int64 time,
|
||||
void AddDetectionFrameSize(const cv::Rect_<float>& position, const int64_t time,
|
||||
const int width, const int height,
|
||||
CalculatorRunner* runner,
|
||||
const AddDetectionFlags& flags = {}) {
|
||||
|
@ -275,7 +275,7 @@ void AddDetectionFrameSize(const cv::Rect_<float>& position, const int64 time,
|
|||
}
|
||||
}
|
||||
|
||||
void AddDetection(const cv::Rect_<float>& position, const int64 time,
|
||||
void AddDetection(const cv::Rect_<float>& position, const int64_t time,
|
||||
CalculatorRunner* runner) {
|
||||
AddDetectionFrameSize(position, time, 1000, 1000, runner);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ absl::Status ParseAspectRatioString(const std::string& aspect_ratio_string,
|
|||
}
|
||||
void ConstructExternalRenderMessage(
|
||||
const cv::Rect& crop_from_location, const cv::Rect& render_to_location,
|
||||
const cv::Scalar& padding_color, const uint64 timestamp_us,
|
||||
const cv::Scalar& padding_color, const uint64_t timestamp_us,
|
||||
ExternalRenderFrame* external_render_message, int frame_width,
|
||||
int frame_height) {
|
||||
auto crop_from_message =
|
||||
|
@ -717,7 +717,7 @@ absl::Status SceneCroppingCalculator::FormatAndOutputCroppedFrames(
|
|||
for (int i = 0; i < num_frames; ++i) {
|
||||
// Set default padding color to white.
|
||||
cv::Scalar padding_color_to_add = cv::Scalar(255, 255, 255);
|
||||
const int64 time_ms = scene_frame_timestamps_[i];
|
||||
const int64_t time_ms = scene_frame_timestamps_[i];
|
||||
if (*apply_padding) {
|
||||
if (has_solid_background_) {
|
||||
double lab[3];
|
||||
|
@ -747,7 +747,7 @@ absl::Status SceneCroppingCalculator::FormatAndOutputCroppedFrames(
|
|||
|
||||
// Resizes cropped frames, pads frames, and output frames.
|
||||
for (int i = 0; i < num_frames; ++i) {
|
||||
const int64 time_ms = scene_frame_timestamps_[i];
|
||||
const int64_t time_ms = scene_frame_timestamps_[i];
|
||||
const Timestamp timestamp(time_ms);
|
||||
auto scaled_frame = absl::make_unique<ImageFrame>(
|
||||
frame_format_, scaled_width, scaled_height);
|
||||
|
|
|
@ -175,7 +175,7 @@ constexpr int kMinNumDetections = 0;
|
|||
constexpr int kMaxNumDetections = 10;
|
||||
|
||||
constexpr int kDownSampleRate = 4;
|
||||
constexpr int64 kTimestampDiff = 20000;
|
||||
constexpr int64_t kTimestampDiff = 20000;
|
||||
|
||||
// Returns a singleton random engine for generating random values. The seed is
|
||||
// fixed for reproducibility.
|
||||
|
@ -254,7 +254,7 @@ std::unique_ptr<ImageFrame> MakeImageFrameFromColor(const cv::Scalar& color,
|
|||
// Randomly generates a number of detections in the range of kMinNumDetections
|
||||
// and kMaxNumDetections. Optionally add a key image frame of random solid color
|
||||
// and given size.
|
||||
void AddKeyFrameFeatures(const int64 time_ms, const int key_frame_width,
|
||||
void AddKeyFrameFeatures(const int64_t time_ms, const int key_frame_width,
|
||||
const int key_frame_height, bool randomize,
|
||||
CalculatorRunner::StreamContentsSet* inputs) {
|
||||
Timestamp timestamp(time_ms);
|
||||
|
@ -286,7 +286,7 @@ void AddScene(const int start_frame_index, const int num_scene_frames,
|
|||
const int key_frame_width, const int key_frame_height,
|
||||
const int DownSampleRate,
|
||||
CalculatorRunner::StreamContentsSet* inputs) {
|
||||
int64 time_ms = start_frame_index * kTimestampDiff;
|
||||
int64_t time_ms = start_frame_index * kTimestampDiff;
|
||||
for (int i = 0; i < num_scene_frames; ++i) {
|
||||
Timestamp timestamp(time_ms);
|
||||
if (inputs->HasTag(kVideoFramesTag)) {
|
||||
|
@ -657,7 +657,7 @@ TEST(SceneCroppingCalculatorTest, PadsWithSolidColorFromStaticFeatures) {
|
|||
|
||||
// Add inputs.
|
||||
auto* inputs = runner->MutableInputs();
|
||||
int64 time_ms = 0;
|
||||
int64_t time_ms = 0;
|
||||
int num_static_features = 0;
|
||||
for (int i = 0; i < kSceneSize; ++i) {
|
||||
Timestamp timestamp(time_ms);
|
||||
|
|
Loading…
Reference in New Issue
Block a user