Ask Your Question

AhmedSh3ban's profile - activity

2020-03-10 03:25:23 -0600 received badge  Notable Question (source)
2019-09-12 02:14:15 -0600 received badge  Popular Question (source)
2018-03-14 02:12:20 -0600 commented answer Error in changing the background color from white to black

Thanks. it works fine. the error i was getting was in the if Codintion. it says "OpenCV Error: Assertion failed (((((si

2018-03-13 08:34:18 -0600 marked best answer Error in changing the background color from white to black

hello. i am trying to change the background color to black. it's white so i am trying to go throught all the pixels and check whether its white or no if so change the value to 0. but somthing went wrong here is my code.

Mat img = imread("t.PNG");
for (int x = 0; x < img.rows; x++)
{
    for (int y = 0; y < img.cols; y++)
    {
        if (img.at<Vec3b>(Point(x, y))[0] >=245 && img.at<Vec3b>(Point(x, y))[1] >= 245 && img.at<Vec3b>(Point(x, y))[2] >= 245)
        {

            img.at<Vec3b>(Point(x, y)) = { 0,0,0 };
        }       
    }   
}
imwrite("img.png",img);
imshow(" ",img);
waitKey(0);

 here is the image i am trying to convert

2018-03-13 02:28:00 -0600 asked a question Error in changing the background color from white to black

Error in changing the background color from white to black hello. i am trying to change the background color to black. i

2018-03-06 19:24:04 -0600 asked a question whats are the values of red in HSV?

whats are the values of red in HSV? hi. i trying to detect objects according to the color. so i found out some says H:0

2018-02-13 02:43:26 -0600 asked a question can i replace an object in an image with another object?

can i replace an object in an image with another object? Hello. can i replace an object in an image with another object.

2017-12-15 18:42:57 -0600 commented answer is my concept of infomax wrong or right?

thanks, but why do i get nan values if i set the size(200,200)? doesn't it work of high img size?

2017-12-15 12:43:17 -0600 marked best answer is my concept of infomax wrong or right?

hi. sorry guys i would like to know if my concept of implementation ICA infomax is wrong or what because the result is blank image. here is my code:

/***

                            This is ICA infomax implementation 
                            equation :  X = AS  where X is the mixture matrix, A is mixing matrix, S is the source

                            SO ------> S = WX   where W is unmixing matrix. 
                            and since there no way that we can recover the excat source image but 
                            so we use U instead of S where U ~= S 
                            which gives us  U = WX

                            W = learning rate (YU) W + W

                            where Y = -tanh(U/2)
                            YU = I + Y (U)t

***/
#include <iostream>
#include <math.h>
#include <opencv2/opencv.hpp>
 using namespace std;
 using namespace cv;

 const char* depthToStr(int depth) {
  switch(depth){
    case CV_8U: return "unsigned char";
    case CV_8S: return "char";
    case CV_16U: return "unsigned short";
    case CV_16S: return "short";
    case CV_32S: return "int";
    case CV_32F: return "float";
    case CV_64F: return "double";
  }
  return "invalid type!";
}

 void ICA(Mat &w, Mat x, Mat &s)
 {

    // get the size of the unmixing matrix
    int Weightrows = x.rows;
    int Weightcols = x.rows;

    // learning rate
    float lnrate = 0.95;

    // U = source (s)
    Mat u;

    // y ---> is super guassian 
    Mat y;

    // YU
    Mat yu;
    // creating I (indentity matrix)
    Mat I = Mat::eye (x.rows, x.rows, CV_64F);

    // number of iterates
    int iteratesNumber = 0;



    // creating the unmixing matrix and set it to random variables
     w.create(Weightrows, Weightrows, CV_64F);
     randu(w, Scalar(-1), Scalar(1));

     x.convertTo(x, CV_64F);
     u.convertTo(u, CV_64F);
     cout << depthToStr(x.depth()) << endl << depthToStr(u.depth()) << endl<<depthToStr(w.depth()) <<endl;
    for(int iter = 0; iter < 10; iter++)
    {
        u = w * x;


        // set the super guassian (nonlinear)

        Mat tanh1, tanh2, tanh;
        exp (u, tanh1);
        exp (-1 * u , tanh2);

        tanh  = (tanh1 - tanh2) / (tanh1 + tanh2);
        y = -1 * tanh;

        yu = I + y * u.t(); 

        w = 0.95  * yu * w + w;

    }

    s = w * x;

 }
 int main()
 {
    Mat Image, weight, result;

    Image = imread("/home/pixar/Desktop/rmi.jpeg",0);
    imshow(" s", Image);


    ICA(weight, Image, result);
        cout << result <<endl;
        imshow(" ", result);
        waitKey(0);
    return 0;
 }
2017-12-15 12:43:16 -0600 received badge  Supporter (source)
2017-12-09 02:34:41 -0600 received badge  Student (source)
2017-12-06 12:56:19 -0600 edited question is my concept of infomax wrong or right?

is my concept of infomax wrong or right? hi. sorry guys i would like to know if my concept of implementation ICA infoma

2017-12-06 12:09:55 -0600 commented question is my concept of infomax wrong or right?

the output wasn't as i expected

2017-12-06 12:09:21 -0600 edited question is my concept of infomax wrong or right?

is my concept of infomax wrong or right? hi. sorry guys i would like to know if my concept of implementation ICA infoma

2017-12-06 12:09:00 -0600 edited question is my concept of infomax wrong or right?

is my concept of infomax wrong or right? hi. sorry guys i would like to know if my concept of implementation ICA infoma

2017-12-06 12:08:57 -0600 edited question is my concept of infomax wrong or right?

is my concept of infomax wrong or right? hi. sorry guys i would like to know if my concept of implementation ICA infoma

2017-12-06 12:08:21 -0600 edited question is my concept of infomax wrong or right?

is my concept of infomax wrong or right? hi. sorry guys i would like to know if my concept of implementation ICA infoma

2017-12-06 10:42:49 -0600 asked a question is my concept of infomax wrong or right?

is my concept of infomax wrong or right? hi. sorry guys i would like to know if my concept of implementation ICA infoma

2017-12-04 10:12:13 -0600 commented question error while saving model with svm

Thanks. you were right everything is fine now

2017-12-04 08:39:30 -0600 commented question error while saving model with svm

i didn't. i just want to save the features .

2017-12-04 08:10:23 -0600 asked a question error while saving model with svm

error while saving model with svm i am trying to implement svm but every time i try to save the model after training it

2017-11-28 16:56:27 -0600 marked best answer how can i load 4d medical image of type nifti?

how can i load 3d or 4d medical image of type nifti (.nii) in c++??

2017-11-28 16:56:27 -0600 received badge  Scholar (source)
2017-11-28 09:13:33 -0600 commented question how can i load 4d medical image of type nifti?

Thanks for your effor i will check this out. and for sample this is 3d https://www.mediafire.com/file/bfxx0k9nxb6f778/ex

2017-11-28 00:16:37 -0600 received badge  Enthusiast
2017-11-27 22:25:45 -0600 commented question how can i load 4d medical image of type nifti?

Thanks for your effor i will check this out. and for sample this is 4d https://www.mediafire.com/file/bfxx0k9nxb6f778/ex

2017-11-27 22:25:34 -0600 commented question how can i load 4d medical image of type nifti?

Thanks for your effor i will check this out. amd for sample this is 4d https://www.mediafire.com/file/bfxx0k9nxb6f778/ex

2017-11-27 22:21:41 -0600 commented question how can i load 4d medical image of type nifti?

Thanks for your effore i will check this out. amd for sample this is 4d https://www.mediafire.com/file/bfxx0k9nxb6f778/e

2017-11-26 08:13:24 -0600 asked a question how can i load 4d medical image of type nifti?

how can i load 4d medical image of type nifti? how can i load 3d or 4d medical image of type nifti (.nii) in c++??

2017-11-21 03:53:17 -0600 commented question can we apply pca on 4D data

i don't know yet still want to learn more about ICA. but i think yes.

2017-11-21 02:48:46 -0600 commented question can we apply pca on 4D data

thanks break for help. i got it now

2017-11-21 02:28:51 -0600 commented question can we apply pca on 4D data

lets say i do MRI test and i want to know the active regions in the brain during that test. so it records the behavior o

2017-11-21 01:57:09 -0600 commented question can we apply pca on 4D data

My data is 4d (fmri 4d image) what I want to achieve with pca is to make dimension reduction

2017-11-20 11:01:27 -0600 edited question can we apply pca on 4D data

can we apply pca on 4D data can we use OpenCv PCA function on 4D data (x,y,z,t)?

2017-11-20 10:26:57 -0600 asked a question can we apply pca on 4D data

can we apply pca on 4D data can we use PCA algorithm on 4D data (x,y,z,t)?

2017-11-16 10:58:58 -0600 commented question why we do reshape to the matrix of an image before doing pca

i deleted the last question because i figured it out. but this is another question. all i want to know what reshape func

2017-11-16 09:22:52 -0600 received badge  Editor (source)
2017-11-16 09:22:52 -0600 edited question why we do reshape to the matrix of an image before doing pca

why we do reshape to the matrix of an image before doing pca Hi. i am trying to implement PCA algorithm on an image but

2017-11-16 09:05:39 -0600 asked a question why we do reshape to the matrix of an image before doing pca

why we do reshape to the matrix of an image before doing pca Hi. i am trying to implement PCA algorithm on an image but

2017-11-16 07:22:56 -0600 asked a question is reducing the dimensions using PCA means that i also reduce the numbers of the channels of an image?

is reducing the dimensions using PCA means that i also reduce the numbers of the channels of an image? i know this maybe

2017-11-16 07:22:33 -0600 received badge  Organizer (source)