Skip to content

Commit 38fd2e8

Browse files
committed
Make example style transfer working with identity image function.
1 parent 854e609 commit 38fd2e8

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

demos/video/style-transfer/style_transfer.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,21 @@ int run_webcam_model(torch::jit::Module& module, int cam_index, int max_fps, boo
201201
auto prepped_input = preprocess_input(mps_tensor);
202202
std::cout << "Prepped input sizes: " << prepped_input.sizes() << std::endl;
203203
std::cout << "Prepped input sizes: " << prepped_input.sizes() << std::endl;
204-
205-
auto output = prepped_input;
204+
205+
auto output_tensor = prepped_input;
206+
auto output = output_tensor;
206207
auto processed_output = output.to(torch::kCPU,true);
207208

208209
// output_bgr = to_mat(processed_output);
209210

210211
cv::Mat output_rgb = to_mat(processed_output);
211212
// output_bgr = output_rgb;
212-
cv::cvtColor(output_rgb, output_bgr, cv::COLOR_RGB2BGR);
213213
// cv::cvtColor(output_rgb, output_bgr, cv::COLOR_RGB2BGR);
214+
// cv::cvtColor(output_rgb, output_bgr, cv::COLOR_RGB2BGR);
215+
216+
217+
cv::cvtColor(frame_rgb, output_bgr, cv::COLOR_RGB2BGR);
218+
214219

215220

216221
} else {

0 commit comments

Comments
 (0)