Is there a way in Java or OpenCv ; preferably Java, that i can have an HSV histogram give RGB image.
I tried exploring JAI but it creates histogram for RGB image.
Thanks
Harshit
I have an embedded application where an image scanner sends out a stream of 16-bit pixels that are later assembled to a grayscale image. As I need to both save this data locally and forward it to a network interface, I'd like to compress the data stream to reduce the required storage space and network bandwidth.
Is there a simple algorithm that I can use to losslessly compress the pixel data?
I first thought of computing the difference between two consecutive pixels and then encoding this difference with a Huffman code. Unfortunately, the pixels are unsigned 16-bit quantities so the difference can be anywhere in the range -65535 .. +65535 which leads to potentially huge codeword lengths. If a few really long codewords occur in a row, I'll run into buffer overflow problems.
Hey all-
I'm using ParallelPython to develop a performance-critical script. I'd like to share one value between the 8 processes running on the system. Please excuse the trivial example but this illustrates my question.
def findMin(listOfElements):
for el in listOfElements:
if el < min:
min = el
import pp
min = 0
myList = range(100000)
job_server = pp.Server()
f1 = job_server.submit(findMin, myList[0:25000])
f2 = job_server.submit(findMin, myList[25000:50000])
f3 = job_server.submit(findMin, myList[50000:75000])
f4 = job_server.submit(findMin, myList[75000:100000])
The pp docs don't seem to describe a way to share data across processes. Is it possible?
If so, is there a standard locking mechanism (like in the threading module) to confirm that only one update is done at a time?
l = Lock()
if(el < min):
l.acquire
if(el < min):
min = el
l.release
I understand I could keep a local min and compare the 4 in the main thread once returned, but by sharing the value I can do some better pruning of my BFS binary tree and potentially save a lot of loop iterations.
Thanks-
Jonathan
Hi
Currently working in Java, i'd like to be able to select part of an image using the mouse pointer co ordinates. The area selected then needs to be cut from the existing image and used to create a new separate image.
I am using the mid-point circle algorithm (bresenham circle) to efficiently draw whole circles. Is there something similar to draw circle arcs? I would like to specify a start angle and end angle and have only that portion of the circle drawn.
Thanks in advance!
EDIT: I would like to draw filled circle arcs too, i.e pie-slices. :)
I want to display a image using SmallBASIC. For this I've started by searching on the references, then I found a reference for IMAGE, that is like this:
IMAGE #handle, index, x, y [,sx,sy [,w,h]]
Then I found another to open files(OPEN):
OPEN file [FOR {INPUT|OUTPUT|APPEND}] AS #fileN
But I want to know some things:
What image types this function can display?
There is any real example to use IMAGE?
How do I write a batch process on the Mac for pdf2swf, I want to convert all pdfs in a folder into swf. But pdf2swf doesn't have a option to convert a folder of pdfs to swfs, you have to do it one at a time. I'm not sure how if I should use a Apple script or a Shell script, either one I'm not sure how to get or assign a file name variable.
pdf2swf file_name_variable.pdf -o file_name_variable.swf -T 9 -f
Thanks
Hi everyone,
I'm writing a little plugin for imageJ and I am drawing several regions as an overlay on the image.
I'm using this code:
ImagePlus imp = getImage();
Overlay ov = new Overlay();
for (int r=0; r<regions.length; r++)
{
ov.add(regions[r]);
}
imp.setOverlay(ov);
Where regions is an array of Roi.
This works as intended and draws the regions in the (hurting to my eyes) standard ImageJ cyan used for overlays. I would like to draw one particular region in another colour, but I cannot seem to find a way to do it. I found that you can change the colour of the whole overlay, but I need two colours in the same overlay.
Any ideas?
Thanks in advance
nico
Hi all,
I'm experimenting with filtering through elements in parallel. For each element, I need to perform a distance calculation to see if it is close enough to a target point. Never mind that data structures already exist for doing this, I'm just doing initial experiments for now.
Anyway, I wanted to run some very basic experiments where I generate random vectors and filter them. Here's my implementation that does all of this
(defn pfilter [pred coll]
(map second
(filter first
(pmap (fn [item] [(pred item) item]) coll))))
(defn random-n-vector [n]
(take n (repeatedly rand)))
(defn distance [u v]
(Math/sqrt (reduce + (map #(Math/pow (- %1 %2) 2) u v))))
(defn -main [& args]
(let [[n-str vectors-str threshold-str] args
n (Integer/parseInt n-str)
vectors (Integer/parseInt vectors-str)
threshold (Double/parseDouble threshold-str)
random-vector (partial random-n-vector n)
u (random-vector)]
(time (println n vectors
(count
(pfilter
(fn [v] (< (distance u v) threshold))
(take vectors (repeatedly random-vector))))))))
The code executes and returns what I expect, that is the parameter n (length of vectors), vectors (the number of vectors) and the number of vectors that are closer than a threshold to the target vector. What I don't understand is why the programs hangs for an additional minute before terminating.
Here is the output of a run which demonstrates the error
$ time lein run 10 100000 1.0
[null] 10 100000 12283
[null] "Elapsed time: 3300.856 msecs"
real 1m6.336s
user 0m7.204s
sys 0m1.495s
Any comments on how to filter in parallel in general are also more than welcome, as I haven't yet confirmed that pfilter actually works.
Please consider following use case,
I have one bigger image, lets called is master image.
Now from some where else, I am getting one small image. I want to check whether this small image is subset of master image or not.
important points are,
smaller image might have different file format,
smaller image might captured from comparatively different view.
smaller image may have different light intensity.
At this stage of algorithm/computation advancement, which level of accuracy I could expect?
Any algorithm/open source implementation that would have such implementation?
Thanks,
Rajnikant
This is refined version of my previous question. Actually I want to do following operation...
summation for all k|(i,j)?wk [(Ii-µk)*(Ij-µk)], where wk is a 3X3 window, µk is the mean of wk, Ii & Ij are the intensities of the image at i and j.
I dont know how to select Ii & Ij separately from an image which is 2 dimensional[Iij]...or does the equation mean anything else?
I'm using the python OpenCV bindings and at the moment I try to isolate a colorrange. That means I want to filter out everything that is not reddish.
I tried to take only the red color channel but this includes the white spaces in the Image too.
What is a good way to do that?
Kind of new to JQuery and I was wondering how can I state that the users submitted info was saved when they click the submit button by displaying the message Changes saved at the top of the form and then have it disappear when the user leaves the web page and return back to it?
Right now my code only displays that changes were saved at the bottom of the form outside of the lists and will not disappear when the users leave the web page and return back to it.
Here is the JQuery code.
$(function() {
$(".save-button").click(function() {
$.post($("#contact-form").attr("action"), $("#contact-form").serialize(), function(html) {
$("div.contact-info-form").html(html);
$('#contact-form').append('<li>Changes saved!</li>');
});
return false; // prevent normal submit
});
});
Here is the html code.
<div id="contact-info-form" class="form-content">
<h2>Contact Information</h2>
<form method="post" action="index.php" id="contact-form">
<fieldset>
<ul>
<li><label for="address">Address 1: </label><input type="text" name="address" id="address" size="25" class="input-size" value="<?php if (isset($_POST['address'])) { echo $_POST['address']; } else if(!empty($address)) { echo $address; } ?>" /></li>
<li><label for="address_two">Address 2: </label><input type="text" name="address_two" id="address_two" size="25" class="input-size" value="<?php if (isset($_POST['address_two'])) { echo $_POST['address_two']; } else if(!empty($address_two)) { echo $address_two; } ?>" /></li>
<li><label for="city_town">City/Town: </label><input type="text" name="city_town" id="city_town" size="25" class="input-size" value="<?php if (isset($_POST['city_town'])) { echo $_POST['city_town']; } else if(!empty($city_town)) { echo $city_town; } ?>" /></li>
<li><label for="state_province">State/Province: </label>
<?php
echo '<select name="state_province" id="state_province">' . "\n";
foreach($state_options as $option) {
if ($option == $state_province) {
echo '<option value="' . $option . '" selected="selected">' . $option . '</option>' . "\n";
} else {
echo '<option value="'. $option . '">' . $option . '</option>'."\n";
}
}
echo '</select>';
?>
</li>
<li><label for="zipcode">Zip/Post Code: </label><input type="text" name="zipcode" id="zipcode" size="5" class="input-size" value="<?php if (isset($_POST['zipcode'])) { echo $_POST['zipcode']; } else if(!empty($zipcode)) { echo $zipcode; } ?>" /></li>
<li><label for="country">Country: </label>
<?php
echo '<select name="country" id="country">' . "\n";
foreach($countries as $option) {
if ($option == $country) {
echo '<option value="' . $option . '" selected="selected">' . $option . '</option>' . "\n";
}
else if($option == "-------------") {
echo '<option value="' . $option . '" disabled="disabled">' . $option . '</option>';
}
else {
echo '<option value="'. $option . '">' . $option . '</option>'."\n";
}
}
echo '</select>';
?>
</li>
<li><label for="email">Email Address: </label><input type="text" name="email" id="email" size="25" class="input-size" value="<?php if (isset($_POST['email'])) { echo $_POST['email']; } else if(!empty($email)) { echo $email; } ?>" /><br /><span>We don't spam or share your email with third parties. We respect your privacy.</span></li>
<li><input type="submit" name="submit" value="Save Changes" class="save-button" />
<input type="hidden" name="contact_info_submitted" value="true" />
<input type="submit" name="submit" value="Preview Changes" class="preview-changes-button" /></li>
</ul>
</fieldset>
</form>
</div>
Hi all,
I am writing a program in C# in which I have a set of 200 points displayed on an image. However, the points tend to cluster in various regions, and I am looking to find a way to "cluster." In other words, maybe draw a circle/ellipse around the clustered points.
Has anyone seen any way to do this? I have heard about K-means clustering, but I am not sure how to implement it in C#.
Any favorite implementations out there?
Cheers,
Brett
Hi Guys,
Currently a bit stuck, wondering if anyone can assist. I am using django-adminfiles. Which is a near little application. I want to use it to insert images into posts/articles/pages for a site i am building.
How django-adminfiles works is it inserts a placeholder i.e <<< ImageFile and this gets rendered using a django template. It also has the feature of inserting custom options i.e (Insert Medium Image) , i figured i would used this to automatically resize images and include it in the post (similar to how WP does it).
Django-adminfiles makes use of sorl.thumbnail app to generate thumbnails.
So i have tried testing generating thumbnails:
The current template that is used to render the inserted image is:
{% spaceless %}
<img src="{{ upload.upload.url }}" width="{{ upload.width }}" height="{{ upload.height }}" class="{{ options.class }}" class="{{ options.size }}" alt="{% if options.alt %}{{ options.alt }}{% else %}{{ upload.title }}{% endif %}" />
{% endspaceless %}
I tried modifying this to:
{% load thumbnail %}
{% spaceless %}
<img src="{% thumbnail upload.upload.url 200x50 %}" width="{{ upload.width }}" height="{{ upload.height }}" class="{{ options.class }}" class="{{ options.size }}" alt="{% if options.alt %}{{ options.alt }}{% else %}{{ upload.title }}{% endif %}" />
{% endspaceless %}
I get the error:
Exception Value:
Caught an exception while rendering: Source file: '/media/uploads/DSC_0014.jpg' does not exist.
I figured the thumbnail needs the absolute path so tried putting that in the template, and that works.
i.e this works:
{% thumbnail '/Users/me/media/uploads/DSC_0014.jpg' 200x50 %}
So basically i need to generate the absolute path to the file give the relative path (to web root). You could do this by passing the MEDIA_ROOT setting to the template, but the reason i want to do a template tag is to programmatically set the image size.
I need to search for lines in a CSV file that end in an unterminated, double-quoted string.
For example:
1,2,a,b,"dog","rabbit
would match whereas
1,2,a,b,"dog","rabbit","cat bird"
1,2,a,b,"dog",rabbit
would not.
I have very limited experience with regular expressions, and the only thing I could think of is something like
"[^"]*$
However, that matches the last quote to the end of the line.
How would this be done?
This answer to this question may seem obvious, but I'm actually struggling with it quite a bit. I've searched through JFileChooser methods in the API, and I've looked at some of the questions already asked and answered here on stackoverflow.
My question is this. In my program, I am to allow the user to type in a file name which I will then use to create a brand new file that I will write on. How do you get the text the user has entered in the textfield next to the label "Save As:" on the Save dialog box provided by JFileChooser? Is there a JFileChooser method that would allow me to get that user-inputed text? Or would I have to go through another class, or do something else to get that text?
Thank you so much, to anyone who answers. It's very late for me now, and this program is due in a few hours (meaning I'll be having another sleepless night). Desperate may be too strong a word, but I'm something close enough.
Hi, Can every body tell me by simple answer where & what i can create a batch process for ordinary operations such saving, changing file properties and so...
Hi , i want to find the name of a colour from the hexadecimal colour code. When i get a hex colour code i want to find the most matching colour name. for example for the code #c06040 , how to find out if it is a shade of brown, blue or yellow ?. so that i can find the colour of an object in the image without human intervention.
Is there any relation between the hexadecimal code of the shades of a colour?
please give some sample code if there is any.
I have a small system which consist of: Led Clusters, camera(RGB or grayscale) and an object to be detected. I am emitting a light from the LED clusters (ex: yellow). After emitting light on the object, I am capturing an image for the object from the camera.
I want to get the spectral image of the object from the captured image. Please if any one knows the algorithm or a code for this purpose(grayscale or RGB camera), tell me.
Thanks.....
How do you execute a Unix shell command (awk script, a pipe etc) on a cluster in parallel (step 1) and collect the results back to a central node (step 2)
Hadoop seems to be a huge overkill with its 600k LOC and its performance is terrible
(takes minutes just to initialize the job)
i don't need shared memory, or - something like MPI/openMP as i dont need to synchronize or share anything, don't need a distributed VM or anything as complex
Google's SawZall seems to work only with Google proprietary MapReduce API
some distributed shell packages i found failed to compile, but there must be a simple way to run a data-centric batch job on a cluster, something as close as possible to native OS, may be using unix RPC calls
i liked rsync simplicity but it seem to update remote notes sequentially, and you cant use it for executing scripts as afar as i know
switching to Plan 9 or some other network oriented OS looks like another overkill
i'm looking for a simple, distributed way to run awk scripts or similar - as close as possible to data with a minimal initialization overhead, in a nothing-shared, nothing-synchronized fashion
Thanks
Alex
Hey everyone,
I am interested in doing some document clustering, and right now I am considering using TF-IDF for this.
If I am not wrong, TFIDF is particularly used for evaluating the relevance of a document given a query. If I do not have a particular query, how can I apply tfidf to clustering?
Hi guys
I want to make a program which takes video and audio and merges them. Video Type or audio type is not important for me. I just want to make so- called program. How can i make this ? does any library exist for this ? (I know there are many program about this topic but i want to learn how to implement such a program.)
Help me please about this topic.