New answers tagged

0

If I simply use ColorCombine, I cannot get them to blend to make white as the green channel is dominant: imb = Import["https://i.stack.imgur.com/5dSXa.png"]; img = Import["https://i.stack.imgur.com/XcCRG.png"]; imr = Import["https://i.stack.imgur.com/MmFZ5.png"]; ColorCombine[ColorConvert[#, "Grayscale"] & /@ {imr,...


4

One way to deal with this would be to change the blotc function to generate assymmetric blobs in the first place. blotc2[smoothness_ : 20, points_Integer : 10, symm_ : 0.5] := With[{fun = Exp[-smoothness #.#] &, pts = Transpose[{RandomReal[1 - symm, points], RandomReal[symm, points]}]}, With[{fc = Compile[{xl, yl}, Total[fun[# - {xl, yl}] &...


1

Inner[Times, (v1 m1), v2, List] {{a x, 2 a y, 3 a z}, {4 b x, 5 b y, 6 b z}, {7 c x, 8 c y, 9 c z}} Alternatively: List@@@((m1 v1).v2) or Outer[Times, v1,v2] m1 Data Clear[a,b,c]; v1= {a,b,c} m1= {{1,2,3},{4,5,6},{7,8,9}}; v2={x,y,z}; Comparison Combining with the answer of PaulCommentary: Inner[Times,(m1 v1), v2, List]== List@@@((m1 v1).v2)== (Outer[...


2

ClearAll[array] array[m_Integer, n_Integer] := Array[If[# < #2, 0, Subscript[λ, # - #2, #2]] &, {m, n}, {0, 0}] MatrixForm @ array[5, 5] TeXForm @ MatrixForm@array[5, 5] $$\left( \begin{array}{ccccc} \lambda _{0,0} & 0 & 0 & 0 & 0 \\ \lambda _{1,0} & \lambda _{0,1} & 0 & 0 & 0 \\ \lambda _{2,0} & \lambda _{1,...


4

Is this what you are looking for? M=3; Table[Which[ col<row,0, True,Subscript[λ,col-row,row] ],{col,0,M},{row,0,M}] which returns {{Subscript[λ, 0, 0], 0, 0, 0}, {Subscript[λ, 1, 0], Subscript[λ, 0, 1], 0, 0}, {Subscript[λ, 2, 0], Subscript[λ, 1, 1], Subscript[λ, 0, 2], 0}, {Subscript[λ, 3, 0], ...


7

Matrix operations, especially with vectors, are a bit confusing in Mathematica. ClearAll[v1, v2, a, b, c, x, y, z]; v1 = {a, b, c}; m = Partition[Range[9], 3]; v2 = {x, y, z}; Use MatrixForm to display the expressions nicely. They are still just lists. Map[MatrixForm, {v1, m, v2}]; Then the inner product or Dot gives a scalar as Bill said (1x3, 3x3, 3x1) ...


6

vcoords = AssociationThread[VertexList[g], GraphEmbedding[g]]; threshold = 50.; vlists = Select[Length@# > 1 &]@ Gather[VertexList[g], Norm[vcoords[#] - vcoords[#2]] <= threshold &]; SetProperty[Fold[VertexContract, g, vlists], VertexCoordinates -> {v_ :> vcoords[v]}]


4

You're looking for MorphologicalComponents[*the image*]. This function groups connected areas of white pixels and assigns them a single integer. For example; mc = MorphologicalComponents[Binarize[*the image*]] Then Graphics[Flatten@ Table[Style[Text[mc[[i, j]], {i, j}], 8], {i, 300, 350}, {j, 300, 350}], ImageSize -> 8 72] gives the following ...


8

One approach is to use: MorphologicalComponents[Erosion[img, 1]] // Colorize Then you can access the individual colored sections using ComponentMeasurements. For example: ComponentMeasurements[comp // Colorize, {"Image", "Count", "Mean"}, All, "Dataset"] gives a long list of all the segments and how large they are. ...


0

To my disappointment, I was unable to fix the mesh. Here's what did and maybe this will help somebody else. I generate the mesh and a bounding box. I then shrink the bounding box in the desired axis by 80% which is enough to level off the rough bits at the top and bottom. I then take the intersection of the mesh and the scaled box ... and nothing happens, ...


2

img = RandomImage[1, {350, 150}, ColorSpace -> "RGB"]; Labeled[img, {"https://www.pinterest.com/pin/310115124325383020/"}, {Bottom}]


0

I would suggest drawing the text directly onto the image using ImageCompose or HighlightImage. Example: img = ExampleData[{"TestImage", "Mandrill"}]; {w, h} = ImageDimensions[img]; text = Text[Style["Mandrill", 20, Bold, TextAlignment -> Center]]; textImg = Rasterize@Graphics[{text}, ImageSize -> {w, 25}]; ImageCompose[ ...


2

Is there any ImageCooccurrence extension for Image3D? No. GeneralUtilities`PrintDefinitions@ImageCooccurrence


6

I also get 3201 triangles. I've created a Manipulate so you can see all the triangles flash past your eyes. They are sorted in order of increasing area. Some frames are skipped, but I can assure you all the triangles, including the last full triangle are present if you run the real thing. Hopefully by playing with this Manipulate you'll be convinced: points =...


1

I came up with another method. I can replace the colours in the original quantized image with single numbers to form a palletized grayscale image first. Then ImageFilter works and I get the same image as in @MarcoB's answer - seeing it with two different methods is enough confirmation for me that the image is good. uniquecolours = Flatten[ImageData[img], 1] /...


2

In your 1D MovingMap you are asking for a window of size 1, so the inputs to CountDistinct are lists with only one element, so the output is always 1 (you can see what happens by replacing CountDistinct with an undefined f). You would get closer with something like MovingMap[CountDistinct, yourList, Quantity[3, "Events"]], but I am not convinced ...


9

Extracting a spline from the image is easiest with ImageMesh. I've used the midpoints of the lines on the mesh boundary for the BSplineCurve control points. img = Import["https://i.stack.imgur.com/Yy0uN.png"]; mesh = ImageMesh@img; midpoints = Midpoint /@ MeshPrimitives[mesh, 1]; Graphics[{Thick, Darker[Red], BSplineCurve[midpoints, SplineClosed -> ...


3

This is perhaps a less precise but very fast approach which returns reasonably good widths for these three images. It binarizes the images, and collapses all rows down onto a single row by adding them together and unitizing them. It then looks for runs of zeros in the middle of the row and returns the lengths. I take the Max of these lengths after I call the ...


1

With the scaled down 480p video, cutting out a rough box ROI around the flag and doing a BrightnessEqualize on a volume of frames (i.e Image3D) followed by RemoveBackground works quite nicely for me and it's much simpler than my other segmentation approach: framevolume = Image3D[VideoFrameList[vid, 90]]; ListAnimate[ Image3DSlices@ RemoveBackground[ ...


2

I had to scale the video (and the mask) down to 480p as Mathematica couldn't handle the image processing at high resolution. My approach below naively does a segmentation on each frame and this causes poor temporal coherence in the result leaving holes and flickering artifacts. It's also very slow. I am looking at alternative solutions that overcome these ...


14

Update 2: A simpler/faster approach to get the gap length: ClearAll[hWidth] hWidth = Composition[Max, Cases[p : {0 ..} :> Length[p]], Drop[#, #[[-1, 1]] - 1] &, Drop[#, 1 - #[[1, 1]]] &, Split, Map[Max], Transpose, ImageData, MorphologicalBinarize, ImageCrop]; hWidth /@ {img1, img2, img3} {548, 17, 61} or ClearAll[hWidth2] hWidth2 =...


Top 50 recent answers are included