Skip to content

Commit 94dbf34

Browse files
committed
Don't transpose on the way back to Image
1 parent 49bdb83 commit 94dbf34

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/segmentation.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ if ImageVision.ortex_configured?() do
510510
|> Nx.greater(0)
511511
|> Nx.multiply(255)
512512
|> Nx.as_type(:u8)
513-
|> Nx.transpose()
514513
|> Nx.new_axis(2)
514+
|> Nx.rename([:height, :width, :bands])
515515

516516
binary
517517
|> Image.from_nx!()
@@ -606,8 +606,8 @@ if ImageVision.ortex_configured?() do
606606
|> Nx.greater(0.5)
607607
|> Nx.multiply(255)
608608
|> Nx.as_type(:u8)
609-
|> Nx.transpose()
610609
|> Nx.new_axis(2)
610+
|> Nx.rename([:height, :width, :bands])
611611
|> Image.from_nx!()
612612
|> Image.resize!(orig_w / mask_w, vertical_scale: orig_h / mask_h)
613613

livebooks/image_vision.livemd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ image =
151151
segments = Image.Segmentation.segment_panoptic(image)
152152

153153
# Render a coloured overlay — one colour per segment label.
154-
{:ok, overlay} = Image.Segmentation.compose_overlay(image, segments)
154+
overlay = Image.Segmentation.compose_overlay(image, segments)
155155

156156
Kino.Layout.grid(
157157
[

0 commit comments

Comments
 (0)