74644

Out of Memory using bsxfun MATLAB

Question:

I try to implement image compression using Burrows-Wheeler transform. Consider an 1D matrix from path scanning is:

p = [2 5 4 2 3 1 5];

and then apply the Burrows-Wheeler transform :

function output = bwtenc(p) n = numel(p); x = zeros(length(p),1); for i = 1:length(p) left_cyclic = mod(bsxfun(@plus, 1:n, (0:n-1).')-1, n) + 1; x = p(left_cyclic); end [lex ind] = sortrows(x); output = lex(:,end); output = uint8(output(:)'); end

And it works! But the problem is when i try to implement 1D matrix from Lena.bmp which the size is 512*512, Error message showing that bsxfun is out of memory. Anyone please help me.

Answer1:

See if this works for you -

function output = bwtenc(p) np = numel(p); [~,sorted_ind] = sort(p); ind1 = mod((1:np)+np-2,np)+1; output = p(ind1(sorted_ind)); output = uint8(output(:)'); end

Recommend

  • Unable to open a file with uigetfile in Matlab
  • Reshaping a 3 dimensional array to 2 dimensions
  • Audio Sound Too Low in Android App
  • convert 16 bit grayscale DICOM image to 8 bit: the correct procedure
  • Object size discrepancy
  • Read sequential file - Compressed file vs Uncompresses
  • How enable GZIP compression for Spring HttpInvoker requests using Tomcat?
  • Animate a layout constraint by changing its priority value
  • zip lib (zlib, bzip2) and mono support
  • Matlab - Determine the probability of an Intensity Value
  • mod-rewrite rule for sitemap.xml
  • How to force Hadoop to unzip inputs regadless of their extension?
  • Loading a TGA File and Using it with OpenGL
  • Issue in gzip compression
  • Scheduling a Python Script via Windows Task Scheduler
  • MATLAB Combine matrices of different dimensions, filling values of corresponding indices
  • Is need install mysql on AWS EC2 if i am using AWS rds as database instance?
  • Replace any string in columns with 1
  • Unzip archive in .Net CORE 1.0
  • Save image as is in photo album using swift
  • File extension of zlib zipped html page?
  • git add error : “fatal : malloc, out of memory”
  • How to print columns containing value
  • Reduction and collapse clauses in OMP have some confusing points
  • Calling Worksheet functions from vba in foreign language versions of Excel
  • MongoDb aggregation
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • Deserializing XML into class C#
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • WPF Applying a trigger on binding failure
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Change div Background jquery
  • apache spark aggregate function using min value
  • python draw pie shapes with colour filled
  • Running Map reduces the dimensions of the matrices
  • Binding checkboxes to object values in AngularJs
  • How to Embed XSL into XML
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?