histogram

get histogram data from Mat , opencv android

别说谁变了你拦得住时间么 提交于 2019-12-04 21:52:03
i am working on an android project using opencv , i am creating a histogram for a black and white image (1-0 values on image file) . i am following some tutorials i found on internet on how to create the histogram . i am doing something like this ArrayList<Mat> list = new ArrayList<Mat>(); list.add(mRgba); MatOfInt channels = new MatOfInt(0); Mat hist= new Mat(); MatOfInt histSize = new MatOfInt(25); MatOfFloat ranges = new MatOfFloat(0f, 1f); Imgproc.calcHist(list, channels, new Mat(), hist, histSize, ranges); Then i want to view the data on hist Mat, if i try something like this... for(int i

How can I create a (100%) stacked histogram in R?

末鹿安然 提交于 2019-12-04 21:41:16
问题 My dataset: I have data in the following format (here, imported from a CSV file). You can find an example dataset as CSV here. PAIR PREFERENCE 1 5 1 3 1 2 2 4 2 1 2 3 … and so on. In total, there are 19 pairs, and the PREFERENCE ranges from 1 to 5 , as discrete values. What I'm trying to achieve: What I need is a stacked histogram, e.g. a 100% high column, for each pair, indicating the distribution of the PREFERENCE values. Something similar to the "100% stacked columns" in Excel, or

Skin detection from hue-saturation histogram - OpenCV Python

倾然丶 夕夏残阳落幕 提交于 2019-12-04 19:19:54
I'm working on a little program in python to estimate the direction of pointing gestures with 2D picture from a monocular camera and I'm using OpenCV 2.3. I know it's a bit tricky but I'm motivated! :) My approach is fisrt to use the face detection to detect an area into which I'm sure there is a lot of skin: img = cv2.imread("/home/max/recordings/cameras/imageTEST.jpg",1) img_hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV) hc1 = cv2.CascadeClassifier("/home/max/haarcascade_frontalface_alt.xml") faces1 = hc1.detectMultiScale(img) for (x,y,w,h) in faces1: cv2.rectangle(img, (x,y), (x+w,y+h), 255)

Python: how to make an histogram with equally *sized* bins

这一生的挚爱 提交于 2019-12-04 18:51:43
问题 I have a set of data, and want to make an histogram of it. I need the bins to have the same size , by which I mean that they must contain the same number of objects, rather than the more common (numpy.histogram) problem of having equally spaced bins. This will naturally come at the expenses of the bins widths, which can - and in general will - be different. I will specify the number of desired bins and the data set, obtaining the bins edges in return. Example: data = numpy.array([1., 1.2, 1.3

Faster way to extract histogram from an image

二次信任 提交于 2019-12-04 18:35:40
问题 I'm looking for a faster way to extract histogram data from an image. I'm currently using this piece of code that needs about 1200ms for a 6mpx JPEG image: ImageReader imageReader = (ImageReader) iter.next(); imageReader.setInput(is); BufferedImage image = imageReader.read(0); int height = image.getHeight(); int width = image.getWidth(); Raster raster = image.getRaster(); int[][] bins = new int[3][256]; for (int i = 0; i < width; i++) for (int j = 0; j < height; j++) { bins[0][raster

Multidimension histogram in python

岁酱吖の 提交于 2019-12-04 17:35:09
I have a multidimensional histogram H=histogramdd((x,y,z),bins=(nbins,nbins,nbins),range=((0,1),(0,1),(0,1))) I need to print in an array the values of H which are different from zero and I also need to know the coordinate/the bins where this happens. I am not familiar with tuples. Can you help me? use where to find the index of nozeros in H, and use the index to get the coordinate: import numpy as np x = np.random.random(1000) y = np.random.random(1000) z = np.random.random(1000) nbins = 10 H, [bx, by, bz]=np.histogramdd((x,y,z),bins=(nbins,nbins,nbins),range=((0,1),(0,1),(0,1))) ix, iy, iz =

D3 time and date histogram

社会主义新天地 提交于 2019-12-04 17:15:54
I'm attempting to make a histogram using primarily time and date data, provided in a json file (along with other info) in this format: 2014-03-01 00:18:00. I've looked at http://bl.ocks.org/mbostock/3048450 as an example, but I haven't managed to crack it. The key part seems to be this: var data = d3.layout.histogram() .bins(x.ticks(20)) (dataset.timestamp); When I view my code in the browser it gives "TypeError: data is undefined", and refers to d3.v3.js line 5878. Assuming I fix that error, the next place it may stumble is the axis formatting: var formatDate = d3.time.format("%y-%m-%d %h:%m:

R histogram showing time spent in each bin

北城余情 提交于 2019-12-04 15:41:15
I'm trying to create a plot similar to the ones here : Basically I want a histogram, where each bin shows how long was spent in that range of cadence (e.g 1 hour in 0-20rpm, 3 hours in 21-40rpm, etc) library("rjson") # 3rd party library, so: install.packages("rjson") # Load data from Strava API. # Ride used for example is http://app.strava.com/rides/13542320 url <- "http://app.strava.com/api/v1/streams/13542320?streams[]=cadence,time" d <- fromJSON(paste(readLines(url))) Each value in d$cadence (rpm) is paired with the same index in d$time (the number of seconds from the start). The values are

Producing histogram Map for IntStream raises compile-time-error

a 夏天 提交于 2019-12-04 15:29:31
I'm interested in building a Huffman Coding prototype. To that end, I want to begin by producing a histogram of the characters that make up an input Java String . I've seen many solutions on SO and elsewhere (e.g: here that depend on using the collect() methods for Stream s as well as static imports of Function.identity() and Collectors.counting() in a very specific and intuitive way. However, when using a piece of code eerily similar to the one I linked to above: private List<HuffmanTrieNode> getCharsAndFreqs(String s){ Map<Character, Long> freqs = s.chars().collect(Collectors.groupingBy

Probability distribution function in Python

こ雲淡風輕ζ 提交于 2019-12-04 13:51:41
I know how to create an histogram in Python, but I would like that it is the probability density distribution. Let's start with my example. I have an array d , with a size of 500000 elements. With the following code I am building a simple histogram telling me how many elements of my array d are between every bin. max_val=log10(max(d)) min_val=log10(min(d)) logspace = np.logspace(min_val, max_val, 50) H=hist(select,bins=logspace,histtype='step') The problem is that this plot is not what I want. I would like to have the probability distribution function of my array d . Instead of having the