image,matlab,image-processing,image-segmentation
If you simply want to ignore the columns/rows that lie outside full sub-blocks, you just subtract the width/height of the sub-block from the corresponding loop ranges: overlap = 4 blockWidth = 8; blockHeight = 8; count = 1; for i = 1:overlap:size(img,1) - blockHeight + 1 for j = 1:overlap:size(img,2)...
image,opencv,image-processing,background-subtraction,pixel-manipulation
I made a new class from scratch and that solved the problem.Use the accumulator and frame subtraction methods to recreate the backgoundSubtractorMOG and i developed my own codebook model.
image,matlab,image-processing,computer-vision,vision
Assuming your large image is stored in A, then ind = arrayfun(@(ii) [ceil(ii/8) ,mod(ii-1, 8)+1], 1:40, 'uniformoutput',0); Acell = cellfun(@(rc) A((1:64)+64*(rc(1)-1), (1:64)+64*(rc(2)-1)), ind, 'UniformOutput', 0); should return a cell array Acell containing the individual images. The idea is to generate a vector of indices first, determining the order in which...
matlab,image-processing,image-segmentation,fuzzy-c-means
First rule in segmentation is "try to describe how you (as a human being) were able to do the segmentation". Once you do that the algorithm becomes clear. In other words, you must perform the following 2 tasks: Identify the unique features of each segmented part (in your case -...
python,opencv,image-processing
Use cv2.fillConvexPoly so that you can specify a 2D array of points and define a mask which fills in the shape that is defined by these points to be white in the mask. Some fair warning should be made where the points that are defined in your polygon are convex...
image,matlab,image-processing,computer-vision,matlab-cvst
The error is a bit hard to understand, but I can explain what exactly it means. When you use the CVST Connected Components Labeller, it assumes that all of your images that you're going to use with the function are all the same size. That error happens because it looks...
javascript,node.js,image-processing,subprocess
You are not doing any work in a subprocess. It is just node -i and nothing else. All your image processing happens in the main process. To fix it, you can actually run another Node process and give it some script to execute, say worker.js: process.stdin.on('data',function(data) { var fs =...
php,image-processing,jpeg,watermark,lossless-compression
Realistically, you have to recode. The way to do is to ensure that the component sampling and the quantization tables are the same. That will minimize any recoding distortion.
ios,swift,opencv,image-processing
OpenCV is a framework written in C++. Apple's reference tell us that You cannot import C++ code directly into Swift. Instead, create an Objective-C or C wrapper for C++ code. so you cannot directly import and use OpenCV in a swift project, but this is actually not bad at all...
python,image-processing,time,delay
ummm .... you need basic math here time.sleep(delay-(time.time()-start)) ...
This calls for a morphological reconstruction! In morphological reconstruction, you specify a marker and start reconstructing the original image from that marker point using a morphological dilation. Luckily for us, MATLAB already has a function for that, called imreconstruct in the Image Processing Toolbox, which is called by imreconstruct(marker,image) To...
php,image-processing,imagemagick
I think you can locate the shape pretty accurately with a simple threshold, like this: convert image.jpg -threshold 90% result.jpg and you can then do a Canny edge detection like this: convert image.jpg -threshold 90% -canny 0x1+10%+30% result.jpg The next things I would be looking at are, using the -trim...
shell,image-processing,python-imaging-library
I would use GNU Parallel, like this to make the most of all those cores: find . -name \*.jpg | parallel -j 16 convert {} -resize 256x256 {} If you had fewer files, you could do it like this, but the commandline would be too long for 45,000 files: parallel...
python,opencv,image-processing,adaptive-threshold
As per the documentation, the cv2.adaptiveThreshold() returns only 1 value that is the threshold image and in this case you are trying to receive 2 values from that method, that is why ValueError: too many values to unpack error is raised. After fixing the issue the code may look like:...
image,matlab,image-processing,bin
There are row major and column major programming languages. To simplify, which is the second element in memory? First column second row or second column first row? There is no "right" answer, thus there are programming languages using the one or the other. This is the major problem in your...
image,matlab,image-processing,computer-vision
One simple method would be to threshold the image by some known value once you convert the image to grayscale. The problem with that approach is that we are applying a global threshold and so some of the paper at the bottom of the image will be lost if you...
The image processing operation you need is morphological dilation or, in your case with black dots on white background morphological erosion.
image,matlab,image-processing,svm,imread
The code should output the warning: "Warning: Escape sequence '\U' is not valid. See 'help sprintf' for valid escape sequences. " You need to escape the \ when using sprintf. With yor code path is C:. For examples how proper escaping is done, please check the documentation for sprintf. Instead...
Referencing your answer, using bwconncomp is certainly a valid approach, but the problem here is that the left and right pages are connected if you look at the spine of the book. Therefore, if you tried to do what you suggested, the entire book will be labelled as a single...
c#,image-processing,optimization,winrt-xaml
You are currently awaiting file.GetThumbnailAsync for each file which means that although the function is executed asynchronously for each file, it is executed in order, not in parallel. Try converting each async operation returned from file.GetThumbnailAsyncto a Task and then storing those in a list and then await all tasks...
In MATLAB, many functions make assumptions about the range of values in an image. Usually, images are stored either as uint8 or double. In the case of uint8, the range is 0...255 (which is all possible values in a uint8.). For double, MATLAB chose a value range from 0...1. To...
python,opencv,image-processing,roi
I found answer to my question from here here is my code # import the necessary packages import numpy as np import cv2 # load the image and convert it to grayscale image = cv2.imread('test2.jpg') orig = image.copy() gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # apply a Gaussian blur to the image...
matlab,image-processing,matlab-figure
I interpreted you question as "how can I repeatedly draw black lines with a given width and a specified offset over an image". img = imread('peppers.png'); height = size(img,1); strip_width = 4; strip_offset = 30; line_start_idx = 0:(strip_width+strip_offset):height; line_idx = ndgrid(line_start_idx,1:strip_width)'; line_idx = line_idx(:); line_add = repmat(1:strip_width,1,length(line_start_idx))'; line_idx = line_idx...
opencv,image-processing,3d,camera-calibration
x, y image point only determines a ray from the camera centers through the image point. It has infinite number of possible z and when you multiply images point with inverse matrices you will get an equation of a ray or a line. It is impossible to get 3D from...
matlab,image-processing,matlab-figure,dicom,figure
If you want to talk about "index", we need to go into what are known as indexed images. Take for example the mandrill data set that you can load into MATLAB via: >> load mandrill You see that there is a colour map called map and an indexed image called...
image-processing,glsl,photoshop
Based on the image and description, it looks like this maps the original grayscale value of the image to the blue-green gradient. There are various ways of converting color to grayscale, depending on the color system used. Many of the simple one are just a weighted sum of the RGB...
python,image-processing,imagej
The display range of your image might not be set correctly. Try outputImp.resetDisplayRange() or outputImp.setDisplayRange(Stats.min, Stats.max) See the ImagePlus javadoc for more info....
Generally speaking, the extraction method assumes the knowledge of the embedding rules so it can reverse them. Deterministic processes are hardcoded, while for stochastic processes you need to provide additional information to replicate their state. For example: If you modify a specific DCT coefficient in an 8x8 block, the extraction...
c++,opencv,image-processing,mat
Mat1b and Mat3b are just two pre-defined cases of Mat types, which are defined in core.hpp as follows: typedef Mat_<uchar> Mat1b; ... typedef Mat_<Vec3b> Mat3b; That said, conversion between Mat and Mat1b/Mat3b should be quite natural/automatic: Mat1b mat1b; Mat3b mat3b; Mat mat; mat = mat1b; mat = mat3b; mat1b =...
matlab,image-processing,plot,3d,surface
Setting those values to NaN should do. Here's an example: [x, y] = ndgrid(linspace(-1,1,500)); z = cos(2*pi*(x+y)*2); z(x.^2+y.^2>1) = NaN; %// remove values outside unit circle surf(x,y,z,'edgecolor','none') colorbar view(2) axis equal ...
java,opencv,image-processing,video
From the comment section of a page with some extremely similar code: comment.
matlab,image-processing,matlab-figure
The function axis does different things whether you pass an argument or not. Without any parameters, it returns the current axis bounds (see the documentation here), whereas with parameters, it tries to set the current axis to a specified range (documentation). axises = axis stores the current axis bounds in...
This is basically your script written backwards. Some assumptions have to be made, because not every rectangular matrix can arise from the process you described, and also because the dimensions of the original matrix cannot be uniquely determined from the set of blocks. So, I assume that the original matrix...
opencv,image-processing,opencv3.0
You can use decorrelation stretching for this. Take a look at this. You'll find pre-processing techniques they are using in combination with decorrelation stretching to segment rock paintings. Here in my blog post you'll find an implementation of decorrelation stretching using OpenCV.
python,image-processing,python-imaging-library,tiff
If you can wait until 1st July 2015, the next release of Pillow (the PIL fork) will allow you to check this using n_frames. If you can't wait until then, you can copy that implementation,patch your own version, or use the latest dev version. More info here: https://github.com/python-pillow/Pillow/pull/1261...
objective-c,performance,image-processing
TL;DR - You will want to investigate the use of NSObject -methodForSelector: as a means of avoiding Objective-C runtime overhead. Use this judiciously. - There's some terminology that comes from Smalltalk that is useful in keeping a mental model of what's really going on. We generally refer to invoking a...
python,opencv,image-processing,feature-detection
The main thing to take away is energy function used in this context is any function that is used for a maximization problem. Here, the energy function is the sum of gradients/derivatives/differences (i.e. "detected borders likelihood" in this case). Since you seem to have a non-algorithmic background, I suggest you...
matlab,image-processing,parallel-processing,imread
It looks like you read the same 500 images over and over again, only to access different pixel regions. Better to read the images once, and then access the pixel regions using standard array slicing. I can't really test the code because I don't have your image files and functions,...
android,image,matlab,image-processing,bitmap
If I'm interpreting your question correctly, you have an image stored in the Bitmap class and you want to save this to file locally on your Android device. You then want to load this image into MATLAB for your image recognition algorithm. Given the fact that your image is in...
python,image-processing,image-segmentation,imagej
Thanks for all the suggestions. I have investigated many approaches to this problem and the best result I have had has been using opencv with haar like features cascade classification. I followed this tutorial, and achieved a high degree of accuracy: http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html Here is the result for the first two...
image,matlab,image-processing,image-segmentation,text-segmentation
Yes there is, I guess. First, I am assuming that the second image is EXACTLY the same as the first image, but with colors. The first thing I would do is match the images, as you want the mask to be exactly on top of the other image. To do...
python,image,opencv,image-processing,filtering
This might be what you're looking for: http://matplotlib.org/users/image_tutorial.html Specificially look at the "Examining a specific data range" This will allow you to easily clip the image....
image-processing,machine-learning,computer-vision
Test, Train and Validate Read this stats SE question: What is the difference between test set and validation set? This is basic machine learning, so you should probably go back and review your course literature, since it seems like you're missing some pretty important machine learning concepts. Do we...
If reshape is allowed, permute is definitely allowed. Assuming both the original and block sub-matrix are square matrices Here is one approach out = permute(reshape(A,blSz,size(A,1)/blSz,blSz,[]),[1 3 2 4]); out = reshape(out,size(out,1)*size(out,1),[]); Sample inputs: A = randi(50,8); %// Change it with your original `512x512` matrix blSz = 2; %// Change it...
image,matlab,image-processing,computer-vision,vision
Using rgb2ind performs a colour quantization (the default is uniform quantization directly in RGB space and we also apply dithering to the image) of your image to a certain number of colours (in your case, 256) if you don't specify an input colour map. The map output provides a colour...
python,opencv,image-processing,matching,feature-detection
matches returns a list of structures where each structure contains several fields... among them are two important fields: queryIdx - The index of the feature into kp1 that matches trainIdx - The index of the feature into kp2 that matches You'd use these to index into kp1 and kp2 and...
matlab,opencv,image-processing,computer-vision,emgucv
What you are describing sounds pretty much like the C-HOG (circular HOG) features in the original HOG paper. The only difference wrt typical hog is the shape of the bins. I think it would be best to: iterate over the pixels calculate the circular bin number for each pixel add...
I used already detected corrupted images for analyzing corrupted parts. Then use these results to detect possible corruption. Here is Matlab code: clear; clc; FOLDER1 = './'; query_folder1 = FOLDER1; % Some corrupted samples are here. query_pt1 = dir(strcat(query_folder1, '*.jpg')); nFile1 = length(query_pt1); % file number OFF = 10; for...
c#,image-processing,rgb,getpixel,lockbits
Assuming that rgbValues is a byte array, the statement rgbValues[counter] -= 128; is equivalent to rgbValues[counter] = (byte)(rgbValues[counter] - 128); So if rgbValues[counter] equals zero, it gets set to (byte)(-128). The problem is that, unlike int, the byte data type is unsigned and cannot represent negative values. As EBrown notes,...
The im2uint8 function assumes that your double image is scaled to the range [0,1]. If your image has values larger than 1 or smaller than 0, these values will be clipped. See the following example: im2uint8([-1 0 0.5 1 2]) ans = 0 0 128 255 255 The solution is...
php,image,laravel,image-processing
The code is working - the problem is it's sending extra information. The file is there, it is found, it is being sent. The link to your image returns: HTTP/1.1 200 OK Date: Wed, 17 Jun 2015 22:52:03 GMT Server: Apache Connection: close Content-Type: image/jpeg But the subsequent output is...
php,image,image-processing,bytearray
Use pack to convert data into binary string, es: $data = implode('', array_map(function($e) { return pack("C*", $e); }, $MemberImage)); // header here // ... // body echo $data; ...
image,matlab,image-processing,computer-vision
You are basically trying to deblur a colour image but the process you speak of (deconvolution) assumes a grayscale image. You are getting a dimensions mismatch because doing ./ assumes that the matrices you are dividing with are the same dimensions because this is an element-wise operator. BTW, your beginning...
I found this: "ArrayStoreException -- if an element in the src array could not be stored into the dest array because of a type mismatch." http://www.tutorialspoint.com/java/lang/system_arraycopy.htm Two thoughts: You're copying an int-array into a byte-array. That's not part of the exceptions, but are the dimensions right? arr is a two-dimensional...
Morphological operations are suitable but i would suggest line structuring element as your arrangement is horizontal and you do not want overlaps between lines: clear clc close all BW = im2bw(imread('Silhouette.png')); BW = imclearborder(BW); se = strel('line',10,0); dilateddBW = imdilate(BW,se); img= imerode(BW,se); figure; imshow(img) ...
From the Matlab forums, the dir command output sorting is not specified, but it seems to be purely alphabetical order (with purely I mean that it does not take into account sorter filenames first). Therefore, you would have to manually sort the names. The following code is taken from this...
matlab,image-processing,filter
For filtering this kind of signal, you can try to use the median filter. It might be more appropriated than a means or Gaussian filter. The median filter is very effective on "salt and paper" noise when the mean just blur the noise. As the signal seems very noisy, you...
r,image-processing,fft,cross-correlation
The code looks correct from what I know about phase correlation. If I understand what you want correctly, you are trying to use phase correlation to determine the offset between two images given that their homographies are nothing more than horizontal and vertical offsets. The fact that you're only getting...
html5,image,image-processing,html5-canvas,fabricjs
I made you a jsFiddle based on http://fabricjs.com/dynamic-patterns/ example. You can scale the image to a certain width from img.scaleToWidth(200);. You can now use this to accomplish what you need.
asp.net-mvc,image-processing,image-resizing,imageresizer
Thanks to the suggestion from TiestonT I was able to solve the problem using the SqlReader plugin.
matlab,image-processing,matlab-figure
The problem you are experiencing comes from saving the data to a MATLAB data file, renaming the file with a .jpg extension and trying to use imread to read in the data. This unfortunately doesn't work. You can't change the file type of your data from .mat to .jpg. All...
matlab,image-processing,signals
This forum is not a Give Me the Code service!!!... Having said that, here is precisely what you requested, with the code profusely commented and plotting the image processing steps :)..... %% Processing % Reading Image X0=imread('Pentode 10kHz.gif'); X1=512*(X0([21:219],[15:263])); imshow(512*(1-X1)); X2=X1; % Removing Division Dotted Lines and Axis X2(5:5:end,:)=[]; X2(:,5:5:end)=[];...
You are analyzing the areas of connected white pixels in your image, so you get: the white background (1) the inner area of the benzene ring (1) the inner areas of the two Os (2) the inner areas of the 8 (2) These are six objects in total. Invert your...
image,matlab,image-processing,matlab-figure,coordinate-systems
I found a solution , please feel free to check it for fun :) I = imread('cameraman.tif'); Im1 = imrotate(I,-45); % Image imrotated with loose option Im2 = imrotate(I,-45,'nearest','crop');% Image imrotated with crop option % draw image 1 loose figure(1); subplot(2,1,1), imagesc(Im1), axis image; drawnow; %%Get a point title('Select a...
image,matlab,image-processing,computer-vision
You can use the bitdepth parameter to set that. imwrite(img,'myimg.png','bitdepth',16) Of course, not all image formats support all bitdepths, so make sure you are choosing the the right format for your data....
android,image-processing,bitmap,textures,effect
Create 3 textures, instead of 2: private int[] mTextures = new int[3]; private void loadTextures() { // Generate textures GLES20.glGenTextures(3, mTextures, 0); ... after that, you can apply sequentially two effects one after another, like that: private void applyEffect() { if (mNeedSecondEffect) { mEffect.apply(mTextures[0], mImageWidth, mImageHeight, mTextures[2]); mSecondEffect.apply(mTextures[2], mImageWidth, mImageHeight,...
You need to put the waiKey() inside the for loop for(int i=0;i<=learningframes;i++) { cap>>frame; imshow("nn",frame); cvtColor(frame,framehsv,CV_BGR2HSV); inRange(framehsv,Scalar(0,30,0),Scalar(50,150,255),framethr); framethr.convertTo(framethr,CV_32F); accumulate(framethr,frameaccF); waitKey(0); } ...
python,opencv,image-processing
Create new square image with dimension = diagonal of your initial image. Draw initial image into the center of new image. Rotate new image
python,image-processing,numpy,scipy
You could simply try a median filter with a small kernel size, from scipy.ndimage import median_filter filtered_array = median_filter(random_array, size=3) which will remove the specks without noticeably changing the original image. A median filter is well suited for such tasks since it will better preserve features in your original image...
image,matlab,image-processing,computer-vision,vision
Here is one solution where I make each brain tile a 32x32 image. The comments explain the code. But the basic idea is... using block proc to split the large image into a 5x8 grid, because it has 5 rows of brains and 8 columns of brains. I call each...
python-2.7,image-processing,numpy
Use array slicing. If xmin, xmax, ymin and ymax are the indices of area of the array you want to set to zero, then: a[xmin:xmax,ymin:ymax,:] = 0. ...
image-processing,textures,sift,pattern-recognition,lbph-algorithm
Why do you need a generic algorithm? You have: local non parametric features (like LBP) to capture micro macro features (like corner detectors, sift) overall geometry invariant statistics (like histograms, Fourier transform etc) Just calculate all the features, concatenate them in a single vector and this vector is the result...
This is called "skeletonization" and you can do it with the function bwmorph: bwmorph(Img, 'skel', Inf); Best...
android,opencv,image-processing,colors,pixel
I recommend this excellent article on how to access/modify an opencv image buffer. I recommend "the efficient way": int i,j; uchar* p; for( i = 0; i < nRows; ++i) { p = I.ptr<uchar>(i); for ( j = 0; j < nCols; ++j) { p[j] = table[p[j]]; } Or "the...
javascript,php,css,image,image-processing
Even there are a lot of pitfalls in whole process, I would choose doing it using PHP. Firstly, answer yourself following: What exactly will be mostly white background? Does RGB(250,250,250) still counts? Does PNG with alpha channel counts (RGBA)? Does image with light/bright yellow counts? Does image with black border...
python,opencv,image-processing,numpy
If you have the raw image ("my_picture.raw")? You could totally use OpenCV-Python to look at it. raw_data = imread('my_picture.raw') This should give you a numpy array of the pixels that your raw file contains. Then, you can do some basic operations on the data (accessing pixels, doing object/feature recognition, etc.)....
ruby-on-rails,ruby,linux,shell,image-processing
Try: 'rmagick' gem require 'rmagick' image_list = Magick::ImageList.new("image1.png", "image2.png", "image3.png") image_list.write("combine.png") You can also refer this SO Question it's similar to yours....
java,image,scala,image-processing
Before you write it out with ImageIO, create a BufferedImage first. It can be as simple as using the setRGB methods, and has the added benefit of allowing you to observe the image before writing it out.
You can't subindex like that, try: a(u+1,v+1, x+1,y+1)=alpha1(u+1)*alpha2(v+1)*cos((2*x+1)*u*pi/(2*n))*cos((2*y+1)*v*pi/(2*n)) Edit: You had 3 problems. You were still trying to pull data out as if it were a submatrix, then fixing that the dimensions weren't correct, and the error you commented on. This is to fix all of them. imshow(squeeze(mag(i,j,:,:)),[0, 255]); ...
java,opencv,image-processing,colors,javacv
Results for L*a*b* conversion on 8-bit images is automatically scaled: RGB <-> CIE Lab* (CV_BGR2Lab, CV_RGB2Lab, CV_Lab2BGR, CV_Lab2RGB). ... This outputs 0 <= L <= 100, -127 <= a <= 127, -127 <= b <= 127. The values are then converted to the destination data type: 8-bit images L <-...
java,opencv,image-processing,rgb,bgr
If your image is a BufferedImage then you can ask for his type with getType(), and test against the several constants (see: BufferedImage).
c#,opencv,image-processing,emgucv,opencvsharp
Not sure what's wrong with the original C-like code, but I'm managed to get it working with C++ like code: using OpenCvSharp; using OpenCvSharp.CPlusPlus; // ... var image = new Mat("Image.png"); var template = new Mat("Template.png"); double minVal, maxVal; Point minLoc, maxLoc; var result = image.MatchTemplate(template, MatchTemplateMethod.CCoeffNormed); result.MinMaxLoc(out minVal, out...
c#,performance,image-processing,native,template-matching
Did you try locking bits or using FastBitmap implementation? You should be able to find tons of implementations like this one. It should speed up getting pixels multiple times. You just need to take care of properly disposing it.
You should not multiply the RGB values directly. Check this answer: Understanding BufferedImage.getRGB output values You can decompose the image into 3 arrays (r,g,b), do the convoloution and then build a 3 channel image from the single channels. Your sharpening kernel is a addition of an edge filter and the...
java,image-processing,edge-detection,sobel
In your for loops when you check if (i==0 || i==width-1 || j==0 || j==height-1) you should probably be checking for i >= width-2 rather than i==width-1. For example, if width is 10 it falls into the statement if i == 9. you want to catch if i == 8...
matlab,image-processing,plot,histogram
Assuming uint8 precision, each call to imhist will give you a 256 x 1 vector, and so you can concatenate these together into a single 768 x 1 vector. After, call bar with the histc flag. Assuming you have your image stored in im, do this: red = imhist(im(:,:,1)); green...
smooth histogram this filter out small local min max and noise use symmetric smoothing to avoid shifting to one side I smooth from left then from the right which lower the shifting a lot find/count the local max peaks count only big enough peaks (by some treshold) if peak...
As pointed by @Wojciech Frohmberg in the comments, extracting infra red channel from light source (RGB) is not possible, unless you have a camera that can detect infra red rays exclusively. More information can be read from this forum and wiki. To achieve closest effect, I used HSV ColorMap as...
java,arrays,image-processing,bufferedimage
The code below edits the image in place. So no need to create new objects, which should simplify. If you need to keep the original, just copy it entirely first. Also, no need to save to separate arrays. Since you said "shuffle" I assume you want to swap the tiles...
That sounds pretty simple compared to the things you've already implemented; you could calculate an average pixel value per row, and call the resulting signal s(n) (n being the row number). set a threshold for s(n), setting everything below that threshold to 0 and everything above to 1 Assuming you...
image,matlab,image-processing,mask,boundary
It's very simple. I actually wouldn't use the code above and use the image processing toolbox instead. There's a built-in function to remove any white pixels that touch the border of the image. Use the imclearborder function. The function will return a new binary image where any pixels that were...
image,matlab,image-processing,computer-vision,vision
If I understood right you can store the image data as a 2D array and use a colormap to assign it colors, displaying it as a "colorful" image. In this case the colormap will be a Nx3 array where each row corresponds to an index present (or not) in the...