JuliaImages / JuliaImages/juliaimages.github.io
Array casting from channelview question
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 33
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am not sure about how to get an Array containing the values resulting from a convolution to an image.
This is what I tried:
using Images
using TestImages
img = testimage("lena");
K = [[1,1,1] [0,0,0] [-1,-1,-1]];
kernel = centered(K)
border_decision = Inner()
result_conv = imfilter(img, kernel, border_decision)
result_conv_arr = size(Array(channelview(result_conv)))
prints
BoundsError: attempt to access 3×254×254 Array{Float32,3} at index [Base.IdentityUnitRange(1:3), Base.IdentityUnitRange(2:255), Base.IdentityUnitRange(2:255)]
Which I don't quite understand.
Nevertheless, when working with Pad() (or nothing which defaults to Pad) then the API behaves as I would expect:
border_decision = Pad()
result_conv = imfilter(img, kernel, border_decision)
result_conv_arr = size(Array(channelview(result_conv)))
Prints
(3, 256, 256)
-
How can I get an Array in the first case?
-
Is there a method to retrieve the Array containing the data that works no matter how the offsetarray is?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the imfilter, channelview, Inner(), and Pad() examples in the issue, and reproduce the BoundsError using the lena test image. Document how the result differs for offset arrays and what users should do to obtain an Array regardless of its offsets; done means both questions have clear guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100