Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8549907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:49:41+00:00 2026-06-11T13:49:41+00:00

I do have following problem to solve: I have a simple but big gridmap

  • 0

I do have following problem to solve: I have a simple but big gridmap (Size: mX-times-mY). I only distinguish between a tile being occupied by an obstacle or being free.

Now let’s say I use a relatively small sliding window of size n-times-n, so n << mX, n << mY. For ALL possible combinations of occupied and free tiles in that n-times-n window, I assign a identifier (let’s just say a number). Then I take a “snapshot” of a part of my big map in size of that window.

My Question: What is the easiest and/or fastest method to determine the identification number of the current pattern extracted from the map?

To demonstrate: I have a 2×2 Window (so a 2×2 Matrix). There are 2^(2×2)=16 possible combinations of patterns.

Pattern    #1    #2    #3    #4    #5    #6    #7    #8

           00    #0    0#    00    00    ##    #0    00
           00    00    00    #0    0#    00    #0    ##

Pattern    #9    #10   #11   #12   #13   #14   #15   #16

           0#    #0    0#    0#    #0    ##    ##    ##
           0#    0#    #0    ##    ##    0#    #0    ##

with # = obscured
     0 = free

Assuming I extract the pattern

#0
0#

from my map, how can I easily and quickly identify that this is pattern number 10 in aboves example?

My Ideas so far:

1: Simple Looping

Loop over all patterns until I find the correct one, maybe by checking if the difference of both patterns is a zero matrix.

2: Using Row-Sum and Column-Sum as identifier

I sum all n rows and all n columns and use those sums as subindices in an multidimensional array.
For above example: sumRow1 = 1 sumRow2 = 1 sumCol1 = 1 sumCol2 = 1
So my pattern is saved in patternNumbers[1][1][1][1] = 10. Another example would be pattern 16, which would be saved at patternNumbers[2][2][2][2] = 16.

Possible advantage for bigger windows: I only have to calculate 2*n sums and immediately can use those sums to address my pattern I was looking for.
Big, big disadvantage: I need an (2*n)-dimensional Array in which many empty entrys will be left. So relatively big overhead.

Has anyone of you done this before? Any ideas how to solve this? I also did not take into account any sort of symmetry (rotational or line).

Any help is greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:49:42+00:00Added an answer on June 11, 2026 at 1:49 pm

    Well, looks like I found a relatively easy solution which was pointed out by someone else to me:

    By taking all rows or all columns (doesn’t matter, your choice!) in a specific order – which has to be the same for all patterns – and align them as one long vector, then you get a regular binary expression. Just convert that binary number into a decimal number and you have your “unique identifier”.

    Example 1:
    
    00
    #0
    
    can also be written as
    00
    10
    
    now reorder the rows to
    
    0010 = 2
    
    =============================
    
    Example 2:
    
    ##
    00
    
    can also be written as
    11
    00
    
    now reorder the rows to
    
    1100 = 12
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a simple way to solve the following problem? I have an eclipse
maybe that problem is simple, but I have no Idea how to solve this,
I have the following problem that I want to solve in awk. I have
I have the following problem that the standard library doesn't solve well, and I'm
I am trying to solve the following problem with Puppet: I have multiple nodes.
i'm not sure how to solve the following problem: i have a triangle with
I'm trying to solve the following problem in Redis. I have a list that
I am trying to solve the following problem. Lets say you have the the
I am having the following problem that I cannot solve. Let's say I have
I have a very confusing problem, and I am able to solve it, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.