Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
The source file is named "ReadOutputFile.m".
function ReadOutputFile(inputFile, outputFile)
SPIT = 2;
R_REGULARITY = 8;
%read input, threshold, and level
spitclip = wavread(inputFile);
spitclip = spitclip*(2^15);
fid = fopen('threshBinary.bin', 'rb', 'native');
thresh = fread(fid, 'int16');
fclose(fid);
fid = fopen('signalLevelBinary.bin', 'rb', 'native');
lvl = fread(fid, 'int16');
fclose(fid);
%get start and stop information from output file
outputNumeric = csvread(outputFile);
starts = outputNumeric(:,1);
stops = outputNumeric(:,2);
types = outputNumeric(:,8);
reasons = outputNumeric(:,9);
regularity = outputNumeric(:,7);
indicesOfSpits = find(types==SPIT);
numEvents = length(starts);
eventGate = zeros(1,length(spitclip));
firstSpits = zeros(1,length(spitclip));
chainedSpits = zeros(1,length(spitclip));
maxVal = 800;
%loop through events and plot spits only
%color code by reason
for n = 1:length(indicesOfSpits)
i = indicesOfSpits(n);
if(reasons(i) == R_REGULARITY)
chainedSpits(starts(i):stops(i)) = regularity(i)*800;
else
firstSpits(starts(i):stops(i)) = maxVal;
end
end
plot(spitclip);
hold on;
grid on;
plot(lvl,'r');
plot(thresh, 'y');
plot(firstSpits, 'm');
plot(chainedSpits, 'k');
That looks like Matlab (or the free equivalent octave)
http://en.wikipedia.org/wiki/M_(programming_language)
You would wonder, how easy it is to find the programming language.
By just knowing the suffix.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Using example Test Sheet
Looking to use script in Sheets to;
Read active sheet name [e.g. RED]
Look in SUMMARY Sheet and find matching sheet name in column A and read associated integer [e.g. R1C2]
Multiply that by RED R1C1 and display result in RED R1C2
I would want to be able to do this for all values in column 1 in RED, GREEN & BLUE sheets, either on opening or by using a button
Any pointers would be greatly appreciated!
Your question has been voted down as you haven't shown any research or posted any of your own code. I'll help you out as I too am new here ;-). It is good that you have broken your request down, the next step would have been to start writing code... The following code will do what you have requested, bar it on running on open or by using a button. My advice to getting started with Apps Script would be to read through the reference documents and samples so that you understand fully what the code does.
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = ss.getActiveSheet();
var activeSheetName = activeSheet.getSheetName();
var activeSheetData = activeSheet.getDataRange().getValues();
var summarySheet = ss.getSheetByName("SUMMARY");
var summarySheetData = summarySheet.getDataRange().getValues();
for (var i = 0; i < summarySheetData.length; i++) {
if (summarySheetData[i][0] == activeSheetName) {
valueToMultiplyBy = summarySheetData[i][1];
}
}
for (var j = 0; j < activeSheetData.length; j++) {
var resultOfMultiplication = valueToMultiplyBy * activeSheetData[j][0];
activeSheet.getRange(j+1,2).setValue(resultOfMultiplication);
}
}
How can i caluclate the F1 score using matlab .This code is giving positive results in negative samples also .I think thats because of dynamic background of images in datset. Should i change the dataset for better accuracy or change the approach .Please Help
Thanks
DataSet : http://kt.agh.edu.pl/~matiolanski/KnivesImagesDatabase/KnivesImagesDatabase.rar
CODE:`
TrainingSet = imageSet('Trainingset','recursive');
testSet= imageSet('TestSet','recursive');
img=read(TrainingSet(1),1);
[hog_4x4, vis4x4] = extractHOGFeatures(img,'CellSize',[4 4]);
cellSize = [4 4];
hogFeatureSize = length(hog_4x4);
trainingFeatures= [];
trainingLabels = [];
x= TrainingSet(1).Count;
y= TrainingSet(2).Count;
for digit = 1:numel(TrainingSet)-1
numImages = TrainingSet(digit).Count;
for i = 1:numImages-1
img = rgb2gray(read(TrainingSet(digit), i));
%Apply pre-processing steps
features(i,:) = extractHOGFeatures(img, 'CellSize', cellSize);
end
%labels = repmat(TrainingSet(digit).Description, numImages, 1);
trainingFeatures = [trainingFeatures; features];
%trainingLabels = [trainingLabels; labels ];
end
negativeSize = size(trainingFeatures,1);
trainingLabels = zeros(size(trainingFeatures,1),1);
for digit = 2:2
numImages= TrainingSet(digit).Count;
for i = 1:numImages-1
img = rgb2gray(read(TrainingSet(digit), (i)));
features1(i,:) = extractHOGFeatures(img, 'CellSize', cellSize);
end
%labels = repmat(TrainingSet(digit).Description, numImages, 1);
trainingFeatures = [trainingFeatures; features1];
%trainingLabels = [trainingLabels; labels ];
end
positiveLabels = ones(size(trainingFeatures,1) - negativeSize,1);
trainingLabels = [trainingLabels ; positiveLabels];
classifier = fitcsvm(trainingFeatures, trainingLabels);
classOrder =classifier.ClassNames;
img=read(testSet(1),1);
img = rgb2gray(img);
[testFeatures, testLabels] = extractHOGFeatures(img, 'CellSize', cellSize);
%Make class predictions using the test features.
predictedLabels = predict(classifier, testFeatures);
if(predictedLabels==1)
warndlg('Object Detected','!! Warning !!');
else
warndlg('Object Not Detected','!! Warning !!');
end
I strongly recommend using Faster-rcnn for the problem. It is one of the state-of-the art Convolutional Neural Network architectures used extensively for object detection task. Here is a matlab implementation of the same.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Only if it's possible; for example one panel for FPS and another one for MS
Thanks, best regards
Yes, you can have multiple:
var stats1 = new Stats();
stats1.showPanel(0); // Panel 0 = fps
stats1.domElement.style.cssText = 'position:absolute;top:0px;left:0px;';
document.body.appendChild(stats1.domElement);
var stats2 = new Stats();
stats2.showPanel(1); // Panel 1 = ms
stats2.domElement.style.cssText = 'position:absolute;top:0px;left:80px;';
document.body.appendChild(stats2.domElement);
And then in your main loop
stats1.update();
stats2.update();
stats.js r17
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am trying to transfer some part of my image to another matrix with this code:
p1 = zeros(512,512,3);
p1(1:128, 1:128, 1:3) = image(1:128, 129:256, 1:3);
And when this code did not work I tried with 3 for loop
and after that I tried to transfer R G B layers separately:
p1(1:128, 1:128, 1) = image(1:128, 129:256, 1);
But none of these codes work. Could anyone tell me what to do?
In Matlab you can always assign one matrix to another with the same size. For example:
A = ones (4,2,3,4,5);
B = zeros(4,2,3,4,5);
A = B
will run with no errors.
It is possible that the type of the image you are using is uint8 (8-bit unsigned integer), while zeros creates a double matrix. This will result in improper behavior of operations or built-in functions, if you do not cast (change the type of) your matrices properly. Use whos to check the type of your image:
whos image
Try to cast the zeros to uint8:
p1 = uint8(zeros(512,512,3));
...
Here is an example:
image = imread('peppers.png');
partail_im = uint8(zeros(size(image)));
partail_im(1:128,1:128,:) = image(1:128,129:256,:);
imshow(partail_im);
Note: It's better not to use image as the name of any variable since it's name of a built-in function image.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
What's the shortest way to combine say 20 256x256 thumbnails into a single large image of 4 rows by 5 columns using RMagick?
Assuming all the images are in the current directory and named from 1.jpg to n.jpg and row * col = n.
include Magick
row = NUM_ROWS
col = NUM_COLS
ilg = ImageList.new
1.upto(col) {|x| il = ImageList.new
1.upto(row) {|y| il.push(Image.read((y + (x-1)*col).to_s + ".jpg").first)}
ilg.push(il.append(false))}
ilg.append(true).write("out.jpg")