

some troubleshootin Saikumar. from India [20 posts] 
11 years

Hi STeven,
1>How can i find out in which coloured region the given coordinate is?
suppose there are just 3 colours in the image, and given certain coordinate as input from some variable,it needs to find me the colour @ that place.
2>how do i run a for loop in VBscript.Please can i have its syntax.
3>I have got a very strange problem here:I want to have the blob array such a way that
the array has all its blob's cogs' in a linear fashion.
i.e. continious coordinates along the bottom most row,from left to right blob.
and so on towards topmost row.
Where as now,when i use it gives arbitrary COGs' of blobs.
4>for simple arithmetic manippulations on coordinates,should i always use VB script?
Thnkyou
Saikumar.



Saikumar. from India [20 posts] 
11 years

Hi Steven,
Would be very thankfull if you had helped me out in atleast
3,4
Please :)
Thankyou



Anonymous 
11 years

Saikumar,
1. You could use the color_sample module to set coordinates at a location and then read the COLOR_SAMPLE variable for that location. You'd have to enter the coordinates into the X,Y locations using [startx], [starty], etc. ie do not type in a number but use a [variable] (unless the coordinates do not change ...)
Another possibility is to use the GetPixels routine in the VBScript module to get all the image pixels (assuming your image is not too big) and then you could read the pixel data directly using a VBScript style array access.
2. There are a couple ways to do a loop. You can check Microsoft's site for documentation on VBScript ... but you can use
for i = 0 to 10 step 1
next
or
while i < 10
i=i+1
wend
There are a lot of websites out there that show how to do this. For example
http://www.powerbasic.com/support/help/pbcc/while_wend_statements.htm
seems like it has the needed info (first link from a google search).
3. Please download the latest version of RR. We have added some sort checkboxes in the blob_filter module to sort the coordinates in both X and Y order which should give you the order that you are looking for.
4. Yes, you can use the VBScript module for simple calculations and/or processing. If the calculations get more complex or you need to process additional long lists then using the Extensions to create a DLL that can be added into RoboRealm would be the way to go. The DLL can be written in C++ which would process much faster than VBScript (note you could also use other JIT type languages like Java, C#, etc. to get almost C++ speed).
STeven.



Saikumar. from India [20 posts] 
11 years

Thankyou very much Steve,
You are as helpful as ever.
Cheers!
Saikumar.



Saikumar. from India [20 posts] 
11 years

Hi STeven,
Regarding problem 1.
I need to check the colour samples of "N" blobs, then how am i suppose to go about?
I guess i cant use a VBscript,< Vbscrip to calculate the effective position of different blobs
Actual problem being i need to compare surrounding "N" different circles of 4 different colours,to evaluate the array of blobs in increasing intensity of their colours.
Thankyou :)



Anonymous 
11 years

Saikumar,
Perhaps you can include an image to better indicate what you are looking for. Please also try to achieve the result yourself and let us know when you get stuck. Including the attempt as a robofile and an example image will get you to your results quicker.
Thanks,
STeven.



Saikumar. from India [20 posts] 
11 years

Hi Steven,
I have attached the pic.
The problem statement goes like this>
colour red,green,yellow,etc are given different weightage,and the bot needs to traverse throught the least weighted path.From the lowest left blob>to topmost right blob.
I thought i would go about this way
>find max radius of any blob
>then go about finding the approximate coordinates of 2 neighbours and also as to which colour it might be,and compare it with second.[note:i need to make15such checks to reach the destination]
>hence create a waypoint array appropriately.
Sorry for the previous vauge post Steven:)
Do let me know if there is anymore ambiguity.
Thankyou
Saikumar.



Anonymous 
11 years

Saikumar,
The image really helps ... we always recommend others to first start with images rather than a description as it lets us understand what you are trying to accomplish. In your case we would take a completely different approach. The attached robofile shows that route.
Basically you want to transform the circles into a simplistic 2x2 array that you can assign weights to and then traverse looking for the optimal path. The transformation process requires the pixelate module and color quantization to create a simple array that contains a specific number for each color.
Rather than explain every step in detail please analyse the included robofile and try to understand this approach. Since this project is most likely for a class we are going to leave the final steps for you to accomplish which should be relatively easy as the included robofile includes all the steps up to creating the weights array which includes a # for each color. What is left is for you to write the search routine for the best path given the colors. Look into breadth first search to accomplish this.
To see the final image you will have to zoom the image up as much as possible since the final image is a 8x8 image. Also note the final weights array starts from bottom left.
STeven. program.robo



Anonymous 
11 years

Saikumar,
Please also be sure to download the latest version 1.8.18.13 which includes an update to the pixelate module that is required by the above robofile.
STeven.



Saikumar. from India [20 posts] 
11 years

Thankyou STeven (:>
Yes I do need to find more effective algorithm, had in mind to find the weights incured through all such 15stepped[15 steps is least distance] and then choose out the optimal.
Yet to get hand of that part.
Lets see how it goes :)
Thanks once again Steve!
Saikumar.
Wish you good luck!



Anonymous 
11 years

Saikumar,
You're on the right track. You will have to use a recursive routine that checks each neighborhood in a recursive manner in a breadth first technique. This basically means you should check each neighbor to see if they are the best solution before exploring each neighbor. If you explore each neighbor first before checking to see if any of them are the solution that would be a depth first search which is not an optimal solution (although it will probably find a solution). Note that the breadth first search will require a lot more memory than the depth first search as you will need to record the paths as they get created. If you have a look at breath first searches on the internet you can probably find sites that explain better how such a solution would work.
Good luck!
STeven.

