Skip to content

Commit d44fdd8

Browse files
committed
increase coverage
1 parent 2ca8e58 commit d44fdd8

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

include/postProcessing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace postprocess
77
{
88

9-
void visualizeFlowfield(const cv::Mat &flowfield, cv::Mat &dst);
9+
cv::Mat visualizeFlowfield(const cv::Mat &flowfield);
1010
cv::Mat visualizeETF(const cv::Mat &flowfield);
1111
cv::Mat antiAlias(const cv::Mat &src);
1212

src/cmd.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ int main(int argc, char *argv[])
9595
cv::cvtColor(vis_etf, vis_etf, CV_GRAY2BGR);
9696
cv::imwrite("visualize-etf.jpg", vis_etf);
9797

98+
// Generate flow-field arrow direction visualization
99+
cv::Mat vis_flow = postprocess::visualizeFlowfield(cld.etf.flowField);
100+
vis_flow.convertTo(vis_flow, CV_8UC3, 255);
101+
cv::cvtColor(vis_flow, vis_flow, CV_RGB2BGR);
102+
cv::imwrite("arrow-etf.jpg", vis_flow);
103+
98104
// Generate Anti-alias coherent line drawing
99105
cv::Mat anti_alias = postprocess::antiAlias(cld.result.clone());
100106
cv::imwrite("anti-alias.jpg", anti_alias);

src/gui.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,9 @@ void BasicDrawPane::render(wxDC &dc, bool render_loop_on)
467467
dis.convertTo(dis, CV_8UC1, 255);
468468
cv::cvtColor(dis, dis, CV_GRAY2BGR);
469469
} else if (processingS == MODE_ETF_DEBUG) {
470-
postprocess::visualizeFlowfield(cld.etf.flowField, dis);
470+
dis = postprocess::visualizeFlowfield(cld.etf.flowField);
471+
dis.convertTo(dis, CV_8UC3, 255);
472+
cv::cvtColor(dis, dis, CV_RGB2BGR);
471473
} else if (processingS == MODE_CLD) {
472474
dis = cld.result.clone();
473475
cv::cvtColor(dis, dis, CV_GRAY2BGR);

src/postProcessing.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,22 @@ cv::Mat visualizeETF(const cv::Mat &flowfield)
5757
}
5858

5959
// visualize ETF by drawing red arrowline
60-
void visualizeFlowfield(const cv::Mat &flowfield, cv::Mat &dst)
60+
cv::Mat visualizeFlowfield(const cv::Mat &flowfield)
6161
{
6262
constexpr int resolution = 10;
63+
cv::Mat dst{flowfield.size(), CV_32FC3, cv::Scalar(1, 1, 1)};
6364

6465
for (int i = 0; i < dst.rows; i += resolution) {
6566
for (int j = 0; j < dst.cols; j += resolution) {
6667
const cv::Vec3f v = flowfield.at<cv::Vec3f>(i, j);
6768
const cv::Point2f p1(j, i);
6869
const cv::Point2f p2(j + v[1] * 5, i + v[0] * 5);
6970

70-
cv::arrowedLine(dst, p1, p2, cv::Scalar(255, 0, 0), 1.5, 8, 0, 0.3);
71+
cv::arrowedLine(dst, p1, p2, cv::Scalar(1, 0, 0), 1.5, 8, 0, 0.3);
7172
}
7273
}
74+
75+
return dst;
7376
}
7477

7578
cv::Mat antiAlias(const cv::Mat &src)

test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ time ./build/cld --src ./data/fingerprint.jpg -o output.jpg --ETF_iter 3 --CLD_i
66
echo '10459bb86077235db3f85fe64d25f2d8 output.jpg' | md5sum -c -
77
echo '3ea95ae0f6f92478af7fbf97e96b2763 anti-alias.jpg' | md5sum -c -
88
echo '1a68133901751c29efe4febec29d014e visualize-etf.jpg' | md5sum -c -
9+
echo '365b29b4d15520b5c92eb78bc6c236b8 arrow-etf.jpg' | md5sum -c -
910

1011
if ! which lcov; then
1112
exit 0

0 commit comments

Comments
 (0)