Which is the best way to estimate measure of photographed things?

find the coin (green bounding box rectangle) either manually or by some search for specific color,pattern,hough transform,segmentation… This will limit the area to search for next steps find the boundary (distinct red edge in color intensity) so create a list of points that are the coin boundary (be careful with shadows) just scan for high … Read more

If I call getMeasuredWidth() or getWidth() for layout in onResume they return 0

You cannot use the width/height/getMeasuredWidth/getMeasuredHeight on a View before the system renders it (typically from onCreate/onResume). Simple solution for this is to post a Runnable to the layout. The runnable will be executed after the View has been laid out. BoxesLayout = (RelativeLayout) findViewById(R.id.BoxesLinearLayout); BoxesLayout.post(new Runnable() { @Override public void run() { int w = … Read more

simplest tool to measure C program cache hit/miss and cpu time in linux?

Use perf: perf stat ./yourapp See the kernel wiki perf tutorial for details. This uses the hardware performance counters of your CPU, so the overhead is very small. Example from the wiki: perf stat -B dd if=/dev/zero of=/dev/null count=1000000 Performance counter stats for ‘dd if=/dev/zero of=/dev/null count=1000000’: 5,099 cache-misses # 0.005 M/sec (scaled from 66.58%) … Read more

Pixel to Centimeter?

Similar to this question which asks about points instead of centimeters. There are 72 points per inch and there are 2.54 centimeters per inch, so just substitute 2.54 for 72 in the answer to that question. I’ll quote and correct my answer here: There are 2.54 centimeters per inch; if it is sufficient to assume … Read more

Easily measure elapsed time

//***C++11 Style:*** #include <chrono> std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); std::cout << “Time difference = ” << std::chrono::duration_cast<std::chrono::microseconds>(end – begin).count() << “[µs]” << std::endl; std::cout << “Time difference = ” << std::chrono::duration_cast<std::chrono::nanoseconds> (end – begin).count() << “[ns]” << std::endl;