Creating colour image map from an array of integers
not really that relvant to swing, or in fact java even but i wasnt sure where to ask it so:
i have an array of integers that represents information about each pixel in an image. i.e. for every pixel there is an integer value.
at the moment i create another image from a quantised version of these integer values, which gives me a greyscale image, where black is low intensity info and white is high.
however what i want to do is create a colour image like you see, for example, on weather forecasts. where low intensity info is blue, then purple, then red, orange, yellow and then white being the highest.
i need some kind of algorithm that does this. does anybody have some code that does this already?
thanks
kevin
sorry for not replying sooner sniper. thanks for your help but i have solved the problem:
thanks to my mate marc for the code.
import java.awt.Color;
/** Class to assist in assigning color to a mathematical value.
* Data values must be normalized.
* @author Marc Ramsdale
* Written 20th August 2003
public class ColorScale {
/** Receives a normalized value (between 0.0 - 1.0)
* The constructor then creates a colour according
* to the selected colour scale.
* If value is outside range 0.0 - 1.0 colour is java.awt.Color.BLACK
* @param double value - (between 0.0 - 1.0)
/** Maps the normalized value to a color
* BLUE *
* GREEN * *
* RED *
public static Color generateColour(double value) {
double red = 0.0;
double green = 0.0;
double blue = 0.0;
Color color;
int gradient = 4;
int offset1 = 2;
int offset2 = 4;
if((value >= 0.0) && (value < 0.25)) {
red = 0.0;
green = value * gradient;
blue = 1.0;
else if((value >= 0.25) && (value < 0.5)) {
red = 0.0;
green = 1.0;
blue = -(value * gradient) + offset1;
else if((value >= 0.5) && (value < 0.75)) {
red = (value * gradient) - offset1;
green = 1.0;
blue = 0.0;
else if((value >= 0.75) && (value <= 1.0)) {
red = 1.0;
green = -(value * gradient) + offset2;
blue = 0.0;
return new Color((float)(red), (float)(green), (float)(blue));
Similar Messages
-
Using TCS2.
I am trying to create an image map in FM and have the hyperlink retained when in the linked RH project. Does anyone know how to do this so that the hyperlink in the active area over an image is retained when bringing the file into RoboHelp (linking to the FM doc) without forcing me to recreate the link in RH? I've read the FM documentation, and I've successfully made the link work in a PDF saved from the FM doc (clicking the graphic successfully launches the link from the PDF), but RH doesn't bring over the hyperlink when I link to the FM doc.
Any ideas?
Thanks,
Michael CohenI don't want to upload it. Its simply a div with a backgound image that consists of artwork and words. The words of course were not typed in Dreamweaver so I can't select them and make links. I'm fairly new to dreamweaver.
Could I place the artwork as an image on the page and then make links? I don't know how to place an image on the page so that it goes anywhere but the upper left corner. We used to use GoLive 6 (the older version of dreamweaver) and place the artwork on the DW page and make links on the artwork. -
Problem creating several image maps (linking to different pdf files) RoboHelp 8
Hi,
I have a problem creating several image map hotspots (that link to different .pdf files), from the same image using RoboHelp 8 HTML (WebHelp project).
After compiling, the first image map hotspot created, opens the .pdf file correctly. Unfortunately, when clicking on the other image hotspots, I get an error " Cannot find file...<file path>... Make sure path or Internet address is correct".
All the pdf documents are located in the same folder within the project.
Can anyone help?Have you added the target files as baggage?
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
Hello, I have a problem with my Image Map. Here are my steps:
1.Create areas for the Image Map
2.Create the Image Map with areas
3.upload the image
4.create the OTH file
5.Enable rendering information option
6.Create KM navigation iView and its layout set mode as default
All references for directories and for my pic are OK but it doesn´t show any Image Map. I need help please!
Thank youHi,
You can follow this example:
In KM, image maps are used for a graphical depiction of folder contents. These objects are displayed using graphics instead of in their normal text form.
Step 1 Determine the image you want to use for navigating. This can be any JPG or GIF file. In this example I will reference the file world.gif.
Step 2 Configuring an image map. Take your image file world.gif and place it in the system. For our example place the file in the path: ../knowledgemanagement/etc/public/graphics. The subdirectory graphics was created within the public folder.
Step 3 In the documents folder, create the following folders:
World
Within the World folder, create the subfolders:
North America
South America
Europe
Asia
Note: you can create as many folders as you like. This structure will serve as the navigation structure for world.gif image map.
Step 4 Determine the navigation coordinates for the image world.gif. Any tool can be used, for this example the tool GeoHTML was used. It is a freeware tool that can be downloaded from http://www.fegi.ru/geohtml.
The following coordinates were determined for the folders:
North America: 253, 255, 303, 285
South America: 424, 171, 474,201
Europe: 368, 43, 418, 73
Asia: 276, 37, 326, 67
Step 5 Create new link-sensitive Areas for the image map. Menu path: Configuration -> Content Management -> User Interface -> Image Maps -> Areas
Please note, an area would need to be defined for each area on the image map that would be link-sensitive areas.
Step 6 Defining an Image Map. In this step the name of the image map will be defined as well as specifying the path of the image, the tooltip, and lastly assigning the areas.
Step 7 Configure an Object Type Handling (OTH) file for the image map. OTH files are located in the /oth subdirectory within the /etc repository. Copy an existing OTH file in this subdirectory and copy it to world.oth. In This OTH file, define the navigation path, collection renderer, layout controller, action and image map. The OTH file should look as follows:
<?xml version="1.0"?>
<ObjectTypeHandler Name="Image Map world"
Class="com.sapportals.wcm.service.objecttypehandler.GenericObjectTypeHandler">
<SelectionCriteria>
<Paths>
<Path>/documents/World</Path>
</Paths>
</SelectionCriteria>
<Properties>
<Property Key="rndCollectionRenderer" Value="ImageMapRenderer"/>
<Property Key="LayoutController" Value="DefaultLayoutController"/>
<Property Key="rndShowActions" Value="false"/>
<Property Key="rndMap" Value="MapOfWorld"/>
</Properties>
<Actions/>
</ObjectTypeHandler>
Step 8 Display the image map. For the navigation iView that is being used, ensure that the iView property Layout Set Mode is set to default.
Step 9 Reload the object type handler in order for the system to read the new oth file world.oth. This can be done by within the Rendering Information link in any navigation iView for a user that is specified in the Debugging Settings (this is done in the user interface configuration).
Another option to reloading the object type handler would be restarting the J2EE engine.
Step 10 In the navigation iView for this mage map, navigate to the image map. In this example, the menu path would be documents/World
Patricio.
ps: If you want I can send you complete example. -
Can you create an image map that will link to a different element on the same page?
I have used image maps before and know how to create an image map to link to a new page. In this case, however, I want to be able to click on my image using an image map and load a new image with text on the same page as the image map. Is this even possible? Is there some sort of behavior that allows you to create same-page links, perhaps using AP divs? I want the end result to be a type of gallery that loads different images depending on where you click on the main image.
Again, I don't even know if this is possible. Any suggestions on how to make this work would be greatly appreciated.
Thank you!Go to this site and mouse over the image map of South America.
http://alt-web.com/testing.html
Is that what you are looking for?
Insofar as linking to a position on the same page, do a Help search (F1) in DW for "named anchors."
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
www.alt-web.com/
www.twitter.com/altweb
www.alt-web.blogspot.com -
Can you create an image map hotspot for an external URL in Dreamweaver CS6?
Can you create an image map hotspot for an external URL in Dreamweaver CS6?
Duplicate post: http://forums.adobe.com/thread/1338701?tstart=0
-
Constructing a linked list from an array of integers
How do I create a linked list from an array of 28 integers in a constructor? The array of integers can be of any value that we desire. However we must use that array to test and debug methods such as getFirst(), getLast(), etc...
I also have a method int getPosition(int position) where its suppose to return an element at the specified position. However, I get an error that says cannot find symbol: variable data or method next()
public int getPosition(int position){
LinkedListIterator iter=new LinkedListIterator();
Node previous=null;
Node current=first;
if(position==0)
return current.data;
while(iter.hasMore()){
iter.next();
if(position==1)
return iter.data;
iter.next();
if(position==2)
return iter.data;
iter.next();
if(position==3)
return iter.data;
iter.next();
if(position==4)
return iter.data;
iter.next();
if(position==5)
return iter.data;
iter.next();
if(position==6)
return iter.data;
iter.next();
if(position==7)
return iter.data;
iter.next();
if(position==8)
return iter.data;
iter.next();
if(position==9)
return iter.data;
iter.next();
if(position==10)
return iter.data;
iter.next();
if(position==11)
return iter.data;
iter.next();
if(position==12)
return iter.data;
iter.next();
if(position==13)
return iter.data;
iter.next();
if(position==14)
return iter.data;
iter.next();
if(position==15)
return iter.data;
iter.next();
if(position==16)
return iter.data;
iter.next();
if(position==17)
return iter.data;
iter.next();
if(position==18)
return iter.data;
iter.next();
if(position==19)
return iter.data;
iter.next();
if(position==20)
return iter.data;
iter.next();
if(position==21)
return iter.data;
iter.next();
if(position==22)
return iter.data;
iter.next();
if(position==23)
return iter.data;
iter.next();
if(position==24)
return iter.data;
iter.next();
if(position==25)
return iter.data;
iter.next();
if(position==26)
return iter.data;
iter.next();
if(position==27)
return iter.data;
iter.next();
if(position==28)
return iter.data;
if(position>28 || position<0)
throw new NoSuchElementException();
}How do I create a linked list from an array of 28 integers
in a constructor? In a LinkedList constructor? If you check the LinkedList class (google 'java LinkedList'), there is no constructor that accepts an integer array.
In a constructor of your own class? Use a for loop to step through your array and use the LinkedList add() method to add the elements of your array to your LinkedList.
I get an error that
says cannot find symbol: variable data or method
next()If you look at the LinkedListIterator class (google, wait for it...."java LinkedListIterator"), you will see there is no next() method. Instead, you typically do the following to get an iterator:
LinkedList myLL = new LinkedList();
Iterator iter = myLL.iterator();
The Iterator class has a next() method. -
Getting Largest Int From an Array of Integers
public class TestMe
public TestMe(int ai[])
_numbers = ai;
public int getBiggest1()
int i = _numbers[0];
for(int j = 1; j < _numbers.length; j++)
if(_numbers[j] >= _numbers[j - 1] && i < _numbers[j])
i = _numbers[j];
return i;
public int getBiggest2()
double d = Math.random();
int i = _numbers[0];
for(int j = 1; j < _numbers.length; j++)
if(d >= 0.10000000000000001D && i < _numbers[j])
i = _numbers[j];
return i;
private TestMe()
private int _numbers[];
}can anyone see what is wrong with either of the two methods as regards returning the largest integer from an array of integers.
As far as I can see they work no matter what ints are in the array.
Any ideas anyone ?
Regards
SeanI used the following client program to use ur class:
I also modified ur class a bit and made the other constructor (the one with no arguments) as public to extend the class.
Both the functions, viz, getBiggest1() and getBiggest2() are working fine...
Now, I am new to JAVA so I might have made mistakes. Please correct me if there is anything wrong.
/*Here is ur class that i have modified*/
public class GetBiggest {
public GetBiggest(int ai[]) {
_numbers = ai;
public int getBiggest1() {
int i = _numbers[0];
for(int j = 1; j < _numbers.length; j++)
if(_numbers[j] >= _numbers[j - 1] && i < _numbers[j])
i = _numbers[j];
return i;
public int getBiggest2() {
double d = Math.random();
int i = _numbers[0];
for(int j = 1; j < _numbers.length; j++)
if(d >= 0.10000000000000001D && i < _numbers[j])
i = _numbers[j];
return i;
public GetBiggest() {
private int _numbers[];
/*Ur class ends here*/
/*My client program starts here*/
import java.lang.*;
public class TestBiggest extends GetBiggest
public static void main (String args[])
int[] arrNums = {30, 20, 40, 10};
GetBiggest GB = new GetBiggest(arrNums);
int greatest = 0;
try
greatest = GB.getBiggest2();
System.out.println("\nBiggest number is : " + greatest);
}//end try block
catch(Exception e)
System.out.println("Some error");
}//end catch block
}//end main
}//end class
/*End of my client program*/ -
How to create a Image object from action script
I need to set the back ground of charting dynamically, thus I need to create Image from a png/gif files. I have wrritten following code, but doesn't work.
public function addBackground():void
var cbg:ChartBackground=new ChartBackground();
var bgs:Array=new Array();
bgs.push(cbg);
lineChart.backgroundElements=bgs;
package arubaUI
import mx.controls.Image;
[Embed(source="../assets/chart_16.png")]
public class ChartBackground extends Image
Does any one knows how to do that?
Thanks!I put the code like and got compile error:
public class ArubaLinePanel extends Panel
private var lineChart:LineChart;
private var lineData:ArrayCollection=new ArrayCollection( [
{ Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450 },
{ Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600 },
{ Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300 },
{ Month: "Apr", Profit: 1800, Expenses: 1200, Amount: 900 },
{ Month: "May", Profit: 2400, Expenses: 575, Amount: 500 } ]);
public function ArubaLinePanel()
super();
lineChart=new LineChart();
lineChart.dataProvider=lineData;
lineChart.showDataTips=true;
var axisX:CategoryAxis=new CategoryAxis()
axisX.categoryField="Month";
lineChart.horizontalAxis=axisX;
var seriesArray:Array = new Array();
var ls:LineSeries=new LineSeries();
ls.yField="Profit";
ls.displayName="Profit";
seriesArray.push(ls);
lineChart.series=seriesArray;
this.addChild(lineChart);
var legend:Legend=new Legend();
legend.dataProvider=lineChart;
this.addChild(legend);
addBackground();
public function addBackground():void
var cbg:ChartBackground=new ChartBackground();
var bgs:Array=new Array();
bgs.push(cbg);
lineChart.backgroundElements=bgs;
Another method I tried:
package arubaUI
import mx.controls.Image;
[Embed(source="../assets/chart_16.png")]
public class ChartBackground extends Image
There is no compile error, but image is not show on screen,
Thanks!
April -
Creating an image file from cd
Good day,
I was wondering how if anyone knows a way to create an ISO image from a cd to run on virtual box. I tried creating one using disk utility, but it did not work. Can this be done through Snow Leopard default programs, or would I need to purchase a new prog?
Tried searching google, but the article I followed was the failed attempt. Did this fail due to copy protection? Before I got rid of my windows pc, I was able to make a copy of the cd, but that would not work either.
The end result would be to mount the iso file on virtual box so I can install age of mythology (Titans expansion) on my XP host. (I know that there is an age of mythology for mac, but its not the latest version, and Virtual box has beta direct X and 3d support).
Any help would be great!
Thanks.Okay. Thanks for trying Perhaps I can pay for the Mac version when I have the cash, then perhaps in a few months/years when enough people have bought the original, they will make the expansion ready on mac as well. And I suppose there is always boot camp.
-
Is there any form to create a movi file from 3D Array in CVI?
Hi,
Anyone knows if using CVI, it is possible to create a movie file (avi) from a 3D Array? And if yes could you tell me how to do that without any commercial dll?
Thanks
Hiram HernandezHola Hiram:
Existe una manera de poder guardar .avi de un arreglo en 3D. Te envío un poco de documentación de cómo poder hacerlo. Necesitaras tener instalado NI-IMAQ.
http://zone.ni.com/devzone/cda/epd/p/id/3709
Espero que solucione tu problema, estoy para servirte.
Luis Guizar
Applications Engineer
National Instruments Mexico -
Create an image / map of folder structure in Finder
Hi there,
I am reorganizing some data that I want to make available for others later on. In order to facilitate the transition for them it would be extremly helpful if I could create a map of the folder structure. I am thinking of something like a mindmap which shows a folder and then each subfolder underneath it. It doesn't need to show the actual files within those folders.
Is there any way to have something like that created automatically? Or maybe some software (freeware would be best of course).
Thanks a lot,
SebastianDuplicate post: http://forums.adobe.com/thread/1338701?tstart=0
-
How to create resized image instance from an existing image
It looks like the image class does not provide a possibility to create a resized instance. Image#impl_getURL() would be good enough to create a resized instance of an existing image - but could be removed in a future release. So what's the preferred way if I have an image object only - there's no information about the based image resource.
You can resize an image on loading using one of the constructors that takes requestedWidth and requestedHeight parameters. This is useful for preserving memory when (for example) needing to display a large number of thumbnails.
Additionally, the ImageView class defines resizing functionality for the view of an Image. So you can load the full Image, then display one or more resized versions in ImageView(s).
If you need, you can retrieve an Image object representing the ImageView by calling snapshot(...) on the ImageView; for most use cases the ImageView itself will be all you need. -
How to create a picture indicator from an array of 32-bit integers
My problem is simple. I have an array of signed 32-bit integers that represents image information. I want to display that information in a picture indicator on the front panel of my VI, but none of the picture indicators accept the array. What conversions or picture control do I need to use?
thanks!Try Draw Unflattened Pixmap.vi.
Lynn -
How can i create a .wav file from an array in v5.0?
I am trying to output an aquired vibration trace as a .wav file.
Hi Brian,
no problem, see attached file.
The file called "To Wav.vi"
Hope it help you.
Mike
Brian wrote:
> I am trying to output an aquired vibration trace as a .wav file.
Attachments:
To_Wav_Folder.zip 53 KB
Maybe you are looking for
-
How can I sync my iPod Touch Calendar to my Vista laptop with out OutLook?
I do not have Outlook and really don't need it, but I need to sync my iPod Touch calendar so it is backed up. Is there another calendar program I can use that will work with Vista? LFLT
-
How can I view 2 tabs at the same time?
I would like to view 2 pages simultaneously. I have dual monitors and I cannot open a second window or start a second Firefox. The function under File/New window does not open a new window. Trying to start Fire fox a second time does not work. Unchce
-
Last weekend, I was asked to DJ my company's Christmas party at a bowling alley. I took my computer and hooked it up to their PA System, and everything went well. But since returning home, my iTunes 8, in the Cover Flow view, says "iTunes is unable t
-
I have been unable to use LR 4 for weeks and I get an error message to the effect: Application unable to start (0xc000007b). What is Adobe's solution to this problem? Its holding up my workflow as a photographer. LouSeyler
-
Cant get rid of product registration reminder
it wont go away no matter if you register or say dont remind me again, i've tried uninstalling creative but its still there, and i cant get rid of the bit that i need to!!? is there a way to completely wipe anything to do with creative off your compu