フィルターのクリア

Need help on function "isfinite" funtion

1 回表示 (過去 30 日間)
pizzaa
pizzaa 2023 年 6 月 23 日
回答済み: Dheeraj 2023 年 8 月 9 日
Can someone help me with isfinite funtion in maltab? I m wondering how this funtion can be used to determined sqrt mean error, median, mean,prctile, of error in each pixel of image 3D reconstruction.
  2 件のコメント
Rik
Rik 2023 年 6 月 23 日
It can't do that. It will do exactly what the documentation tells you: return a logical array indicating whether a value is NaN/inf or not.
Generally this is a first step in selecting valid datapoints to do further calculations. Those further calculations may include computing the RMSE, median, mean, and/or perctiles.
If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). If you have questions after that, have a read here and here. It will greatly improve your chances of getting an answer.
dpb
dpb 2023 年 6 月 23 日
The typical use in those would be to use it as @Rik points out -- as a logical addressing vector/array.
If your dataset does include values that are NaN/Inf, then
mnA=mean(A(isfinite(A)));
will return the mean excluding those elements in the array that are not finite.
There is an 'omitnan' flag built into many of the functions that return population statistics like mean, but not in other standard functions such as sqrt(). The use of that flag, however, traps only NaN values, an Inf will still result in Inf as the result; only isfinite() handles both.

サインインしてコメントする。

回答 (1 件)

Dheeraj
Dheeraj 2023 年 8 月 9 日
Hi,
isfinite” function cannot be directly used to find square mean error, median, mean, percentile of error in each pixel of a 3D image reconstruction, but can be used to identify error cells and apply desired statistic functions on the finite error valued cells.
Assuming you have your reconstructed image and the ground truth image, the code below demonstrates how “isfinite” can be used as the initial step to calculate the necessary statistical measures.
% Step 1: Compute the error for each pixel
error = groundTruthImage - reconstructedImage;
% Step 2: Identify finite elements in the error array
finiteError = error(isfinite(error));
% Step 3: Calculate the desired statistics
sqrtMeanError = sqrt(mean(finiteError));
medianError = median(finiteError);
meanError = mean(finiteError);
prctileError = prctile(finiteError, 75); % Replace 75 with the desired percentile
you could refer to the following documentation for better understanding.

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by