Problem 908. AVIRIS Inscribed Rectangle Bit Mask - Speed Test

The AVIRIS data sometimes is provided uncropped. This creates edge regions with values of "-50". Shown is AVIRIS Moffett Field image Layer 1 (400nm) and a zoom of the top-right corner. The dark blue on the edges is non-imaged ground.

To expedite compression the unused mask can be created with an interior excluded rectangle of no Zeros and maximum pixels. The challenge is to quickly and accurately determine the maximum non-zero inscribed rectangle for this image and some other test cases.

Input: m ( 2-D array with zero and non-zero values )

Output: [idxtlc rmnr rmnc]

  • idxtlc : array index of top left corner
  • rmnr : numer of rows of the non-zero rectangle mask
  • rmnc : number of columns of the non-zero rectangle mask

Score: Time ( msec ) Based upon time to process the 1924x753 AVIRIS image.

(If time-out occurs I suggest downloading the mat file using the test suite code and then optimize with profiler.)

Passing: Minimum number of pixels in rectangle


  • m=[ 1 1 0 1 1......idxtlc = 3 ( index of TLC row 3, col 1)
  • ........1 0 1 1 1......rmnr = 3 ( rectangle mask number rows )
  • ........1 1 1 1 1......rmnc = 5 ( rectangle mask number columns )
  • ........1 1 1 1 1......Maximum rectangle pixels of 15
  • ........1 1 1 1 1 ]

For the AVIRIS image the zero edge bit mask encoding can be reduced 89% using an inscribed rectangle.

Note: Additional test cases may be invoked if hard coded solution achieves best score.

Solution Stats

23.53% Correct | 76.47% Incorrect
Last Solution submitted on Oct 31, 2020

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers4

Suggested Problems

More from this Author308

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!